Exemple #1
0
 internal void AppendSchemaTable(DataTable tbl)
 {
     SQLiteKeyReader.KeyQuery keyQuery = null;
     for (int i = 0; i < (int)this._keyInfo.Length; i++)
     {
         if (this._keyInfo[i].query == null || this._keyInfo[i].query != keyQuery)
         {
             keyQuery = this._keyInfo[i].query;
             if (keyQuery != null)
             {
                 keyQuery.Sync((long)0);
                 using (DataTable schemaTable = keyQuery._reader.GetSchemaTable())
                 {
                     foreach (DataRow row in schemaTable.Rows)
                     {
                         object[] itemArray = row.ItemArray;
                         DataRow  count     = tbl.Rows.Add(itemArray);
                         count[SchemaTableOptionalColumn.IsHidden] = true;
                         count[SchemaTableColumn.ColumnOrdinal]    = tbl.Rows.Count - 1;
                     }
                 }
             }
             else
             {
                 DataRow dataRow = tbl.NewRow();
                 dataRow[SchemaTableColumn.ColumnName]           = this._keyInfo[i].columnName;
                 dataRow[SchemaTableColumn.ColumnOrdinal]        = tbl.Rows.Count;
                 dataRow[SchemaTableColumn.ColumnSize]           = 8;
                 dataRow[SchemaTableColumn.NumericPrecision]     = 255;
                 dataRow[SchemaTableColumn.NumericScale]         = 255;
                 dataRow[SchemaTableColumn.ProviderType]         = DbType.Int64;
                 dataRow[SchemaTableColumn.IsLong]               = false;
                 dataRow[SchemaTableColumn.AllowDBNull]          = false;
                 dataRow[SchemaTableOptionalColumn.IsReadOnly]   = false;
                 dataRow[SchemaTableOptionalColumn.IsRowVersion] = false;
                 dataRow[SchemaTableColumn.IsUnique]             = false;
                 dataRow[SchemaTableColumn.IsKey]                   = true;
                 dataRow[SchemaTableColumn.DataType]                = typeof(long);
                 dataRow[SchemaTableOptionalColumn.IsHidden]        = true;
                 dataRow[SchemaTableColumn.BaseColumnName]          = this._keyInfo[i].columnName;
                 dataRow[SchemaTableColumn.IsExpression]            = false;
                 dataRow[SchemaTableColumn.IsAliased]               = false;
                 dataRow[SchemaTableColumn.BaseTableName]           = this._keyInfo[i].tableName;
                 dataRow[SchemaTableOptionalColumn.BaseCatalogName] = this._keyInfo[i].databaseName;
                 dataRow[SchemaTableOptionalColumn.IsAutoIncrement] = true;
                 dataRow["DataTypeName"] = "integer";
                 tbl.Rows.Add(dataRow);
             }
         }
     }
 }
Exemple #2
0
 private void Sync()
 {
     if (this._isValid)
     {
         return;
     }
     SQLiteKeyReader.KeyQuery keyQuery = null;
     for (int i = 0; i < (int)this._keyInfo.Length; i++)
     {
         if (this._keyInfo[i].query == null || this._keyInfo[i].query != keyQuery)
         {
             keyQuery = this._keyInfo[i].query;
             if (keyQuery != null)
             {
                 keyQuery.Sync(this._stmt._sql.GetRowIdForCursor(this._stmt, this._keyInfo[i].cursor));
             }
         }
     }
     this._isValid = true;
 }