示例#1
0
 /// <summary>Initializes a new instance of the <see cref="SqlDatabase" /> class.</summary>
 /// <param name="storage">The storage engine the database belongs to.</param>
 /// <param name="name">The name of the database.</param>
 protected SqlDatabase(SqlStorage storage, string name)
     : base(storage, name)
 {
     SqlStorage = storage;
     if (name.HasInvalidChars(ASCII.Strings.SafeName))
     {
         throw new ArgumentException("Name contains invalid chars!");
     }
 }
示例#2
0
        /// <summary>Initializes a new instance of the <see cref="SqlSearch" /> class.</summary>
        /// <param name="storage">Storage engine used.</param>
        /// <param name="layout">Layout of the table.</param>
        /// <param name="search">Search to perform.</param>
        public SqlSearch(SqlStorage storage, RowLayout layout, Search search)
        {
            this.storage = storage ?? throw new ArgumentNullException(nameof(storage));
            this.layout  = layout ?? throw new ArgumentNullException(nameof(layout));
            Parameters   = new ReadOnlyCollection <SqlParam>(parameters);
            FieldNames   = new ReadOnlyCollection <string>(fieldNames);
            var sb = new StringBuilder();

            Flatten(sb, search);
            text = sb.ToString();
        }
示例#3
0
        /// <summary>Initializes the interface class. This is the first method to call after create.</summary>
        /// <param name="database">Database the table belongs to.</param>
        /// <param name="flags">Flags used to connect to the table.</param>
        /// <param name="tableName">Table name to load.</param>
        public void Initialize(IDatabase database, TableFlags flags, string tableName)
        {
            Storage = database.Storage as SqlStorage;
            if (Storage == null)
            {
                throw new InvalidOperationException("Database has to be a SqlDatabase!");
            }

            FQTN = Storage.FQTN(database.Name, tableName);
            var schema = QueryLayout(database.Name, tableName);

            base.Connect(database, flags, schema);
        }
示例#4
0
        /// <inheritdoc />
        public override void Connect(IDatabase database, TableFlags flags, RowLayout layout)
        {
            Storage = database.Storage as SqlStorage;
            if (Storage == null)
            {
                throw new InvalidOperationException("Database has to be a SqlDatabase!");
            }

            FQTN = Storage.FQTN(database.Name, layout.Name);
            var schema = QueryLayout(database.Name, layout.Name);

            Storage.CheckLayout(layout, schema);
            base.Connect(database, flags, schema);
        }
示例#5
0
 /// <summary>Initializes a new instance of the <see cref="SqlCommandBuilder" /> class.</summary>
 /// <param name="storage">The storage engine.</param>
 public SqlCommandBuilder(SqlStorage storage)
 {
     this.storage = storage ?? throw new ArgumentNullException(nameof(storage));
     Parameters   = new ReadOnlyCollection <SqlParam>(parameters);
 }