DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
Deveel.Data.SystemSchema.TableColumnsTable Class Reference
Inheritance diagram for Deveel.Data.SystemSchema.TableColumnsTable:
Deveel.Data.Sql.Tables.GeneratedTable Deveel.Data.Sql.Tables.ITable Deveel.Data.Sql.IDbObject

Public Member Functions

 TableColumnsTable (ITransaction transaction)
 
override DataObject GetValue (long rowNumber, int columnOffset)
 Gets a single cell within the table that is located at the given column offset and row. More...
 
- Public Member Functions inherited from Deveel.Data.Sql.Tables.GeneratedTable
IEnumerator< RowGetEnumerator ()
 
virtual ColumnIndex GetIndex (int columnOffset)
 Gets an index for given column that can be used to select values from this table. More...
 
void Dispose ()
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from Deveel.Data.Sql.Tables.GeneratedTable
 GeneratedTable (IContext dbContext)
 
DataObject GetColumnValue (int column, ISqlObject obj)
 

Properties

override TableInfo TableInfo [get]
 
override int RowCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.GeneratedTable
IContext Context [get, private set]
 
ObjectName IDbObject. FullName [get]
 
DbObjectType IDbObject. ObjectType [get]
 
abstract TableInfo TableInfo [get]
 
abstract int RowCount [get]
 
- Properties inherited from Deveel.Data.Sql.Tables.ITable
IContext Context [get]
 
TableInfo TableInfo [get]
 Gets the metadata information of the table, used to resolve the column sources. More...
 
int RowCount [get]
 Gets the total number of rows in the table. More...
 
- Properties inherited from Deveel.Data.Sql.IDbObject
ObjectName FullName [get]
 Gets the fully qualified name of the object used to resolve it uniquely within the database. More...
 
DbObjectType ObjectType [get]
 Gets the type of database object that the implementation is for More...
 

Private Member Functions

int GetRowCount ()
 

Private Attributes

ITransaction transaction
 

Detailed Description

Definition at line 522 of file SystemSchema.cs.

Constructor & Destructor Documentation

Deveel.Data.SystemSchema.TableColumnsTable.TableColumnsTable ( ITransaction  transaction)
inline

Definition at line 525 of file SystemSchema.cs.

526  : base(transaction.Database.Context) {
527  this.transaction = transaction;
528  }
IDatabase Database
Gets the database this transaction belongs to.
Definition: ITransaction.cs:48
new IDatabaseContext Context
Gets the context that contains this database.
Definition: IDatabase.cs:50

Member Function Documentation

override void Deveel.Data.SystemSchema.TableColumnsTable.Dispose ( bool  disposing)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Sql.Tables.GeneratedTable.

Definition at line 607 of file SystemSchema.cs.

607  {
608  transaction = null;
609  base.Dispose(disposing);
610  }
int Deveel.Data.SystemSchema.TableColumnsTable.GetRowCount ( )
inlineprivate

Definition at line 538 of file SystemSchema.cs.

538  {
539  // All the tables
540  var tableManager = transaction.GetTableManager();
541  var list = tableManager.GetTableNames();
542 
543  int colCount = 0;
544  foreach (var tableName in list) {
545  var info = tableManager.GetTableInfo(tableName);
546  if (info == null)
547  throw new InvalidOperationException(String.Format("Table information not found for '{0}'.", tableName));
548 
549  colCount += info.ColumnCount;
550  }
551 
552  return colCount;
553  }
A long string in the system.
override DataObject Deveel.Data.SystemSchema.TableColumnsTable.GetValue ( long  rowNumber,
int  columnOffset 
)
inlinevirtual

Gets a single cell within the table that is located at the given column offset and row.

Parameters
rowNumberThe unique number of the row where the cell is located.
columnOffsetThe zero-based offset of the column of the cell to return.
Returns
Returns an instance of DataObject that is contained in the cell located by the row and column coordinates provided.
Exceptions
ArgumentOutOfRangeExceptionIf the given columnOffset is less than zero or greater or equal than the number of columns defined in the table metadata.
See also
Tables.TableInfo.IndexOfColumn(string)

Implements Deveel.Data.Sql.Tables.GeneratedTable.

Definition at line 555 of file SystemSchema.cs.

555  {
556  // All the tables
557  var tableManager = transaction.GetTableManager();
558  var list = tableManager.GetTableNames();
559  var visibleTables = list.Select(name => transaction.GetTableInfo(name));
560 
561  int rs = 0;
562  foreach (var info in visibleTables) {
563  var schemaName = info.SchemaName == null ? null : info.SchemaName.FullName;
564 
565  int b = rs;
566  rs += info.ColumnCount;
567  if (rowNumber >= b && rowNumber < rs) {
568  // This is the column that was requested,
569  var seqNo = rowNumber - b;
570  var colInfo = info[(int)seqNo];
571 
572  var defaultExpression = colInfo.HasDefaultExpression ? colInfo.DefaultExpression.ToString() : null;
573 
574  switch (columnOffset) {
575  case 0: // schema
576  return GetColumnValue(columnOffset, new SqlString(schemaName));
577  case 1: // table
578  return GetColumnValue(columnOffset, new SqlString(info.Name));
579  case 2: // column
580  return GetColumnValue(columnOffset, new SqlString(colInfo.ColumnName));
581  case 3: // sql_type
582  return GetColumnValue(columnOffset, new SqlNumber((int)colInfo.ColumnType.TypeCode));
583  case 4: // type_desc
584  return GetColumnValue(columnOffset, new SqlString(colInfo.ColumnType.ToString()));
585  case 5: // size
586  return GetColumnValue(columnOffset, new SqlNumber(colInfo.Size));
587  case 6: // scale
588  return GetColumnValue(columnOffset, new SqlNumber(colInfo.Scale));
589  case 7: // not_null
590  return GetColumnValue(columnOffset, (SqlBoolean) colInfo.IsNotNull);
591  case 8: // default
592  return GetColumnValue(columnOffset, new SqlString(defaultExpression));
593  case 9: // index_str
594  return GetColumnValue(columnOffset, new SqlString(colInfo.IndexType));
595  case 10: // seq_no
596  return GetColumnValue(columnOffset, new SqlNumber(seqNo));
597  default:
598  throw new ArgumentOutOfRangeException("columnOffset");
599  }
600  }
601 
602  } // for each visible table
603 
604  throw new ArgumentOutOfRangeException("rowNumber", "Row out of bounds.");
605  }
DataObject GetColumnValue(int column, ISqlObject obj)
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27

Member Data Documentation

ITransaction Deveel.Data.SystemSchema.TableColumnsTable.transaction
private

Definition at line 523 of file SystemSchema.cs.

Property Documentation

override int Deveel.Data.SystemSchema.TableColumnsTable.RowCount
get

Definition at line 534 of file SystemSchema.cs.

override TableInfo Deveel.Data.SystemSchema.TableColumnsTable.TableInfo
get

Definition at line 530 of file SystemSchema.cs.


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