DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
Deveel.Data.Routines.RoutineManager.RoutinesTableContainer Class Reference
Inheritance diagram for Deveel.Data.Routines.RoutineManager.RoutinesTableContainer:
Deveel.Data.SystemTableContainer Deveel.Data.Sql.Tables.ITableContainer

Classes

class  RoutineTable
 

Public Member Functions

 RoutinesTableContainer (ITransaction transaction)
 
override TableInfo GetTableInfo (int offset)
 Gets the information of the table at the given offset in this container. More...
 
override string GetTableType (int offset)
 Gets the type of the table at the given offset. More...
 
override ITable GetTable (int offset)
 Gets the table contained at the given offset within the context. More...
 
- Public Member Functions inherited from Deveel.Data.SystemTableContainer
int FindByName (ObjectName name)
 Finds the index in this container of the given table by its name. More...
 
ObjectName GetTableName (int offset)
 Gets the name of the table at the given index in this container. More...
 
bool ContainsTable (ObjectName name)
 Checks if a table with the given name is contained in the current context. More...
 

Private Member Functions

DataObject GetParameterTypes (string schema, string name)
 
string BuildParameterString (DataObject argName, DataObject argType, DataObject inOut)
 

Static Private Member Functions

static TableInfo CreateTableInfo (string schema, string name)
 

Additional Inherited Members

- Protected Member Functions inherited from Deveel.Data.SystemTableContainer
 SystemTableContainer (ITransaction transaction, ObjectName tableName)
 
- Properties inherited from Deveel.Data.SystemTableContainer
ITransaction Transaction [get, private set]
 
ObjectName TableName [get, private set]
 
int TableCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.ITableContainer
int TableCount [get]
 Returns the total count of tables that this object is maintaining. More...
 

Detailed Description

Definition at line 174 of file RoutineManager.cs.

Constructor & Destructor Documentation

Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.RoutinesTableContainer ( ITransaction  transaction)
inline

Definition at line 175 of file RoutineManager.cs.

176  : base(transaction, SystemSchema.RoutineTableName) {
177  }
static readonly ObjectName RoutineTableName
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37

Member Function Documentation

string Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.BuildParameterString ( DataObject  argName,
DataObject  argType,
DataObject  inOut 
)
inlineprivate

Definition at line 275 of file RoutineManager.cs.

275  {
276  var sb = new StringBuilder();
277  sb.Append(argName.ToString());
278  sb.Append(" ");
279  sb.Append(argType.ToString());
280 
281  if (!inOut.IsNull)
282  sb.Append(" ")
283  .Append(inOut.Value);
284 
285  return sb.ToString();
286  }
bool IsNull
Gets a value that indicates if this object is materialized as null.
Definition: DataObject.cs:91
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
static TableInfo Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.CreateTableInfo ( string  schema,
string  name 
)
inlinestaticprivate

Definition at line 179 of file RoutineManager.cs.

179  {
180  // Create the TableInfo that describes this entry
181  var info = new TableInfo(new ObjectName(new ObjectName(schema), name));
182 
183  // Add column definitions
184  info.AddColumn("type", PrimitiveTypes.String());
185  info.AddColumn("location", PrimitiveTypes.String());
186  info.AddColumn("return_type", PrimitiveTypes.String());
187  info.AddColumn("param_args", PrimitiveTypes.String());
188  info.AddColumn("owner", PrimitiveTypes.String());
189 
190  return info.AsReadOnly();
191  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
Describes the name of an object within a database.
Definition: ObjectName.cs:44
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
DataObject Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.GetParameterTypes ( string  schema,
string  name 
)
inlineprivate

Definition at line 256 of file RoutineManager.cs.

256  {
257  var table = Transaction.GetTable(SystemSchema.RoutineParameterTableName);
258  var rows = table.SelectRowsEqual(1, DataObject.String(name), 0, DataObject.String(schema));
259  var types = new List<string>();
260 
261  foreach (var rowIndex in rows) {
262  var argName = table.GetValue(rowIndex, 1);
263  var argType = table.GetValue(rowIndex, 2);
264  var inOut = table.GetValue(rowIndex, 3);
265 
266  var paramString = BuildParameterString(argName, argType, inOut);
267 
268  types.Add(paramString);
269  }
270 
271  var args = String.Join(", ", types.ToArray());
272  return DataObject.String(args);
273  }
A long string in the system.
The system implementation of a transaction model that handles isolated operations within a database c...
Definition: Transaction.cs:35
static DataObject String(string s)
Definition: DataObject.cs:592
string BuildParameterString(DataObject argName, DataObject argType, DataObject inOut)
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37
static readonly ObjectName RoutineParameterTableName
override ITable Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.GetTable ( int  offset)
inlinevirtual

Gets the table contained at the given offset within the context.

Parameters
offsetThe zero-based offset of the table to return.
Returns
Returns an instance of ITable that provides access to the backed informaion for an object provided by the context.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.SystemTableContainer.

Definition at line 218 of file RoutineManager.cs.

218  {
219  var table = Transaction.GetTable(SystemSchema.RoutineTableName);
220  var rowE = table.GetEnumerator();
221  int p = 0;
222  int i;
223  int rowI = -1;
224  while (rowE.MoveNext()) {
225  i = rowE.Current.RowId.RowNumber;
226  if (p == offset) {
227  rowI = i;
228  } else {
229  ++p;
230  }
231  }
232 
233  if (p != offset)
234  throw new ArgumentOutOfRangeException("offset");
235 
236  string schema = table.GetValue(rowI, 0).Value.ToString();
237  string name = table.GetValue(rowI, 1).Value.ToString();
238 
239  var paramTypes = GetParameterTypes(schema, name);
240 
241  var tableInfo = CreateTableInfo(schema, name);
242  var type = table.GetValue(rowI, 2);
243  var location = table.GetValue(rowI, 3);
244  var returnType = table.GetValue(rowI, 4);
245  var owner = table.GetValue(rowI, 5);
246 
247  return new RoutineTable(Transaction.Database.Context, tableInfo) {
248  Type = type,
249  Location = location,
250  ReturnType = returnType,
251  ParameterTypes = paramTypes,
252  Owner = owner
253  };
254  }
The system implementation of a transaction model that handles isolated operations within a database c...
Definition: Transaction.cs:35
IDatabase ITransaction. Database
Definition: Transaction.cs:105
static TableInfo CreateTableInfo(string schema, string name)
DataObject GetParameterTypes(string schema, string name)
new IDatabaseContext Context
Gets the context that contains this database.
Definition: IDatabase.cs:50
A user-defined TYPE that holds complex objects in a database column.
static readonly ObjectName RoutineTableName
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37
override TableInfo Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.GetTableInfo ( int  offset)
inlinevirtual

Gets the information of the table at the given offset in this container.

Parameters
offsetThe zero-based offset of the table whose information to return.
Returns
Returns an instance of
See also
TableInfo
that describes the metadata of a table at the given offset within the context.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.SystemTableContainer.

Definition at line 193 of file RoutineManager.cs.

193  {
194  var tableName = GetTableName(offset);
195  if (tableName == null)
196  throw new ArgumentOutOfRangeException("offset");
197 
198  return CreateTableInfo(tableName.ParentName, tableName.Name);
199  }
ObjectName GetTableName(int offset)
Gets the name of the table at the given index in this container.
static TableInfo CreateTableInfo(string schema, string name)
override string Deveel.Data.Routines.RoutineManager.RoutinesTableContainer.GetTableType ( int  offset)
inlinevirtual

Gets the type of the table at the given offset.

Parameters
offsetThe zero-based offset of the table whose type to return.
Returns
Returns a String that describes the type of table at the given offset.
Exceptions
ArgumentOutOfRangeExceptionIf the given offset is smaller than 0 or greater or equal than TableCount.

Implements Deveel.Data.SystemTableContainer.

Definition at line 201 of file RoutineManager.cs.

201  {
202  var table = GetTable(offset);
203  if (table == null)
204  throw new ArgumentOutOfRangeException("offset");
205 
206  var typeString = table.GetValue(0, 0).Value.ToString();
207  if (String.Equals(typeString, FunctionType, StringComparison.OrdinalIgnoreCase) ||
208  String.Equals(typeString, ExternalProcedureType, StringComparison.OrdinalIgnoreCase))
209  return TableTypes.Function;
210 
211  if (String.Equals(typeString, ProcedureType, StringComparison.OrdinalIgnoreCase) ||
212  String.Equals(typeString, ExternalProcedureType, StringComparison.OrdinalIgnoreCase))
213  return TableTypes.Procedure;
214 
215  throw new InvalidOperationException(String.Format("The type {0} is invalid as routine table type.", typeString));
216  }
A long string in the system.
const string Procedure
Definition: TableTypes.cs:30
const string Function
Definition: TableTypes.cs:31
override ITable GetTable(int offset)
Gets the table contained at the given offset within the context.
Provides the constant names of the types of tables in a database system.
Definition: TableTypes.cs:24

The documentation for this class was generated from the following file: