예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }