public static object[,] fUtilityDataTableSortAndGet(string handle, object[] headers, object SortAscending, object noHeadersInput) { var table = PersistentObjects.GetFromMap <DataTable>(handle, "DATATABLE"); var output = ExcelFriendlyConversion.ConvertDataTableToObjectArray(table); return(fUtilityTableSortByHeader(output, headers, SortAscending, noHeadersInput)); }
public static string fUtilityPutDataTable(string handle, object[,] data) { PersistentObjects.AssertReservedWordsTableName(handle); PersistentObjects.AddToMap(handle, ExcelFriendlyConversion.ConvertObjectArrayToDataTable(handle, data), "DATATABLE"); return(handle); }
public static string fUtilityObjectsStoreSql(string handle, object[] sqlStatement) { string sql = fUtilityReadSql(sqlStatement); PersistentObjects.AddToMap(handle, sql, "SQL"); return(handle); }
internal static string GetDefaultCsvPath(object arg) { if (arg is ExcelMissing) { return(PersistentObjects.GetFromMap <string>(Constant.DefaultCsvHandle, "PATH")); } else { return(arg.ToString()); } }
private void Awake() { //print("Awake: Persistent Objects.cs"); if (_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(instance); }
public static object[,] fUtilityDataTablesGetFields(string handle) { var table = PersistentObjects.GetFromMap <DataTable>(handle, "DATATABLE"); var fields = DataTableUtility.GetFields(table); var output = new object[fields.Count, 1]; for (int i = 0; i < fields.Count; i++) { output[i, 0] = fields[i]; } return(output); }
public static string DetermineIfSqlHandleOrSqlQuery(string sqlHandleOrString) { // Should be modified when more clever object store is implemented if (PersistentObjects.ContainsKey(sqlHandleOrString, "SQL")) { return(PersistentObjects.GetFromMap <string>(sqlHandleOrString, "SQL")); } else { return(sqlHandleOrString); } }
public static object[,] fUtilityGetDataTable(string handle, object noHeadersInput) { bool noHeaders = Optional.Check(noHeadersInput, false); if (ExcelDnaUtil.IsInFunctionWizard()) { return(new object[0, 0]); } else { var output = PersistentObjects.GetFromMap <DataTable>(handle, "DATATABLE"); return(ExcelFriendlyConversion.ConvertDataTableToObjectArray(output, noHeaders)); } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); }
public static string fUtilityDataBasePutDataTableFromSQLADODB(string handle, string connectionString, string sqlStringOrHandle) { PersistentObjects.AssertReservedWordsTableName(handle); string sql = ObjectInfo.DetermineIfSqlHandleOrSqlQuery(sqlStringOrHandle); if (ExcelDnaUtil.IsInFunctionWizard()) { return("no wizard."); } var table = DatabaseFunctionality.GetDataTableFromSQLAdoDb(sql, connectionString); table.TableName = handle; PersistentObjects.AddToMap(handle, table, "DATATABLE"); return(handle); }
public static string fUtilityQueryDataTable(string handle, string sqlStringOrHandle) { PersistentObjects.AssertReservedWordsTableName(handle); string sql = ObjectInfo.DetermineIfSqlHandleOrSqlQuery(sqlStringOrHandle); var tableHandle = ParsingFunctionality.GetTableNameFromSqlQuery(sql); if (PersistentObjects.ContainsKey(tableHandle, "DATATABLE") == false) { return("ERROR: DataTable + " + tableHandle + " does not exist in the object map."); } else { var newTable = QueryCSV.QueryDataTable(sql, PersistentObjects.CsvPath); newTable.TableName = handle; PersistentObjects.AddToMap(handle, newTable, "DATATABLE"); return(handle); } }
public static object[,] fUtilityQueryDataTable(string sqlStringOrHandle, object noHeadersInput) { string sql = ObjectInfo.DetermineIfSqlHandleOrSqlQuery(sqlStringOrHandle); object[,] output; bool noHeaders = Optional.Check(noHeadersInput, false); var tableHandle = ParsingFunctionality.GetTableNameFromSqlQuery(sql); if (PersistentObjects.ContainsKey(tableHandle, "DATATABLE") == false) { string errorMessage = "ERROR: DataTable + " + tableHandle + " does not exist in the object map."; output = new object[1, 1]; output[0, 0] = errorMessage; return(output); } else { var newTable = QueryCSV.QueryDataTable(sql, PersistentObjects.CsvPath); output = ExcelFriendlyConversion.ConvertDataTableToObjectArray(newTable, noHeaders); return(output); } }
public static string fUtilitySetDefaultCsvPath(string path) { PersistentObjects.SetDefaultCsvPath(path); return("DEFAULT CSV PATH SET TO: " + path); }
public static int fUtilityDataTablesGetRowCount(string handle) { var table = PersistentObjects.GetFromMap <DataTable>(handle, "DATATABLE"); return(table.Rows.Count); }
private void cmdAdd() { bool repeat = true; int count = 0; string path = ""; string objName = ""; PersistentObjects objs = new PersistentObjects(); while ( repeat ) { Console.WriteLine( "Enter count to add:" ); string str = Console.ReadLine(); try { count = Convert.ToInt32( str ); repeat = false; } catch { } } Console.WriteLine( "Enter object name:" ); objName = Console.ReadLine(); repeat = true; while ( repeat ) { Console.WriteLine( "Enter path to file:" ); path = Console.ReadLine(); if ( (string.IsNullOrEmpty( path )) || File.Exists( path ) ) repeat = false; } Console.WriteLine( DateTime.Now.ToLongTimeString() + ": Starting to create objects " ); TestObject prevObj = null; TestObject obj; Random rnd = new Random(); for ( int i = 0; i < count; i++ ) { obj = new TestObject(); obj.Name = (string.IsNullOrEmpty( objName ) ? i.ToString() : objName); obj._int = rnd.Next( 0, 100 ); obj._bool = ( rnd.Next(0,1) == 1 ? true : false ); obj._double = (Double) rnd.Next( 1, 10 ) / 0.33; obj._datetime = DateTime.Now; obj._string = "String for object" + obj._int; if ( !string.IsNullOrEmpty( path ) ) obj._stream = new PersistentStream( path ); if ( prevObj != null ) obj.Parents.Add( prevObj ); objs.Add( obj ); prevObj = obj; } Console.WriteLine( DateTime.Now.ToLongTimeString() + ": Starting to SAVE objects " ); if ( m_transEnabled ) { m_trans = getTrans(); m_trans.Add( objs, PersistentTransaction.ACTION.Save ); Console.WriteLine( DateTime.Now.ToLongTimeString() + ": Add request added to transaction" ); } else { foreach ( PersistentObject cpobj in objs ) cpobj.Save(); Console.WriteLine( DateTime.Now.ToLongTimeString() + ": End" ); Console.WriteLine( " " + objs.Count + " was added.\n" ); } }
public static object[,] DataTableGetInfoCsv(string handle) { var table = PersistentObjects.GetFromMap <DataTable>(handle, DEFINITIONS.DATATABLE_FIELD); return(CreateDataTableInfo(table)); }