Пример #1
0
 public foreign_key(SQLiteConnectionStringBuilder SQLConnSetting, SQLiteDataReader rs, foreign_keys owner)
 {
     _Owner = owner;
     SQLConnSet.ConnectionString = SQLConnSetting.ConnectionString;
     AddFromRecordSet(rs);
     _ForeignKeyColumns = new foreign_key_columns(SQLConnSet, this);
 }
Пример #2
0
        //private void AddFromRecordSet(SQLiteDataReader rs)
        //{
        //    try
        //    {
        //        if (!rs.IsDBNull(0)) { _create_date = rs.GetDateTime(0); }
        //        if (!rs.IsDBNull(1)) { _filestream_data_space_id = rs.GetInt32(1); }
        //        if (!rs.IsDBNull(2)) { _has_replication_filter = rs.GetBoolean(2); }
        //        if (!rs.IsDBNull(3)) { _has_unchecked_assembly_data = rs.GetBoolean(3); }
        //        if (!rs.IsDBNull(4)) { _is_merge_published = rs.GetBoolean(4); }
        //        if (!rs.IsDBNull(5)) { _is_ms_shipped = rs.GetBoolean(5); }
        //        if (!rs.IsDBNull(6)) { _is_published = rs.GetBoolean(6); }
        //        if (!rs.IsDBNull(7)) { _is_replicated = rs.GetBoolean(7); }
        //        if (!rs.IsDBNull(8)) { _is_schema_published = rs.GetBoolean(8); }
        //        if (!rs.IsDBNull(9)) { _is_sync_tran_subscribed = rs.GetBoolean(9); }
        //        if (!rs.IsDBNull(10)) { _large_value_types_out_of_row = rs.GetBoolean(10); }
        //        if (!rs.IsDBNull(11)) { _lob_data_space_id = rs.GetInt32(11); }
        //        if (!rs.IsDBNull(12)) { _lock_on_bulk_load = rs.GetBoolean(12); }
        //        if (!rs.IsDBNull(13)) { _max_column_id_used = rs.GetInt32(13); }
        //        if (!rs.IsDBNull(14)) { _modify_date = rs.GetDateTime(14); }
        //        if (!rs.IsDBNull(15)) { _name = rs.GetString(15); }
        //        if (!rs.IsDBNull(16)) { _object_id = rs.GetInt32(16); }
        //        if (!rs.IsDBNull(17)) { _parent_object_id = rs.GetInt32(17); }
        //        if (!rs.IsDBNull(18)) { _principal_id = rs.GetInt32(18); }
        //        if (!rs.IsDBNull(19)) { _schema_id = rs.GetInt32(19); }
        //        if (!rs.IsDBNull(20)) { _text_in_row_limit = rs.GetInt32(20); }
        //        if (!rs.IsDBNull(21)) { _type = (Object_Type)Enum.Parse(typeof(Object_Type), rs.GetString(21)); }
        //        if (!rs.IsDBNull(22)) { _type_desc = rs.GetString(22); }
        //        if (!rs.IsDBNull(23)) { _uses_ansi_nulls = rs.GetBoolean(23); }
        //    }
        //    catch (Exception)
        //    {
        //        throw;
        //    }
        //}

        public Table(SQLiteConnectionStringBuilder SQLConnSetting, string _tablename)
        {
            SQLConnSet = SQLConnSetting;

            _Columns         = new Columns(SQLConnSetting, this);
            _Indexes         = new Indexes(SQLConnSet, this);
            _foreign_keys    = new foreign_keys(SQLConnSet, this);
            _Keys            = new KeyConstraints(SQLConnSet, this);
            _IdentityColumns = new IdentityColumns(SQLConnSet, this);
        }
Пример #3
0
        public foreign_key(SQLiteConnectionStringBuilder SQLConnSetting, int object_id, foreign_keys owner)
        {
            _Owner = owner;
            SQLConnSet.ConnectionString = SQLConnSetting.ConnectionString;

            using (SQLiteConnection Conn = new SQLiteConnection(SQLConnSet.ConnectionString))
            {
                Conn.Open();
                using (SQLiteCommand Com = Conn.CreateCommand())
                {
                    Com.CommandTimeout = 10;
                    Com.CommandText    = "SELECT name, object_id, principal_id, schema_id, parent_object_id, type, type_desc, create_date, modify_date, is_ms_shipped, is_published, is_schema_published, referenced_object_id, key_index_id, is_disabled, is_not_for_replication, is_not_trusted, delete_referential_action, delete_referential_action_desc, update_referential_action, update_referential_action_desc, is_system_named FROM sys.foreign_keys  WHERE object_id=" + object_id + " AND parent_object_id=" + owner.Owner.object_id + " ORDER BY name";
                    SQLiteDataReader rs = Com.ExecuteReader();
                    while (rs.Read())
                    {
                        AddFromRecordSet(rs);
                    }
                    rs.Close();
                    Conn.Close();
                    rs.Dispose();
                }
            }
            _ForeignKeyColumns = new foreign_key_columns(SQLConnSet, this);
        }