// Get the data // public static DataSet GetData(Workspace Enviro, HScriptParser.Full_table_nameContext context) { // Get the name // string t_name = context.table_name().IDENTIFIER().GetText(); // Global context // if (context.K_GLOBAL() != null) { if (Enviro.ChunkHeap.Exists(t_name)) return Enviro.ChunkHeap[t_name]; throw new HScriptCompileException("Global chunk '{0}' does not exist", t_name); } // Table context // if (context.database_name() != null) { string d_base = context.database_name().IDENTIFIER().GetText(); if (Enviro.Exists(d_base, t_name)) return Enviro.GetStaticTable(d_base, t_name); throw new HScriptCompileException("Table '{0}' does not exist", t_name); } throw new HScriptCompileException("Data '{0}' does not exist in memory or on disk", t_name); }
public static DataSet CreateData(Workspace Enviro, Schema Columns, HScriptParser.Full_table_nameContext context) { // Get the name // string t_name = context.table_name().IDENTIFIER().GetText(); // Global context // if (context.database_name() == null) { RecordSet rs = new RecordSet(Columns); Enviro.ChunkHeap.Reallocate(t_name, rs); return rs; } // Table context // if (context.database_name() != null) { string d_base = context.database_name().IDENTIFIER().GetText(); if (!Enviro.Connections.Exists(d_base)) throw new HScriptCompileException("Connection to '{0}' does not exist", d_base); string dir = Enviro.Connections[d_base]; Table t = new Table(dir, t_name, Columns); return t; } throw new HScriptCompileException("Cannot create data '{0}'", t_name); }
// Create data // public static bool DataExists(Workspace Enviro, HScriptParser.Full_table_nameContext context) { // Get the name // string t_name = context.table_name().IDENTIFIER().GetText(); // Global context // if (context.database_name() == null) { return Enviro.ChunkHeap.Exists(t_name); } // Table context // if (context.database_name() != null) { string d_base = context.database_name().IDENTIFIER().GetText(); return Enviro.Exists(d_base, t_name); } return false; }