/// <summary> /// Initializes a new instance of the <see cref="DbQueryBase"/> class. /// </summary> /// <param name="connectionPool">The <see cref="DbConnectionPool"/> to use for creating connections to execute the query on.</param> /// <param name="commandText">String containing the command to use for the query.</param> /// <exception cref="ArgumentNullException"><paramref name="connectionPool"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="commandText"/> is null or empty.</exception> protected DbQueryBase(DbConnectionPool connectionPool, string commandText) { if (connectionPool == null) throw new ArgumentNullException("connectionPool"); if (string.IsNullOrEmpty(commandText)) throw new ArgumentNullException("commandText"); _connectionPool = connectionPool; _commandText = commandText; // Grab the parameters var p = InitializeParameters(); if (p == null) { // No parameters specified - use the empty list _parameters = _emptyDbParameters; } else { // Use the given parameters, compacted since it is readonly _parameters = p.ToCompact(); // Validate the supplied parameters ValidateParameters(_parameters); } }
/// <summary> /// Initializes a new instance of the <see cref="DbManager"/> class. /// </summary> /// <param name="connectionPool"><see cref="DbConnectionPool"/> to use to create the connections managed by /// this <see cref="DbManager"/>.</param> /// <exception cref="ArgumentNullException"><paramref name="connectionPool" /> is <c>null</c>.</exception> public DbManager(DbConnectionPool connectionPool) { if (connectionPool == null) throw new ArgumentNullException("connectionPool"); _connectionPool = connectionPool; }
/// <summary> /// Initializes a new instance of the <see cref="DbQueryNonReader"/> class. /// </summary> /// <param name="connectionPool">The <see cref="DbConnectionPool"/> to use for creating connections to execute the query on.</param> /// <param name="commandText">String containing the command to use for the query.</param> /// <exception cref="ArgumentNullException"><paramref name="connectionPool"/> is null.</exception> /// <exception cref="ArgumentNullException"><paramref name="commandText"/> is null or empty.</exception> protected DbQueryNonReader(DbConnectionPool connectionPool, string commandText) : base(connectionPool, commandText) { }
/// <summary> /// Initializes a new instance of the <see cref="SelectRepeatableQuestsQuery"/> class. /// </summary> /// <param name="connectionPool"><see cref="DbConnectionPool"/> to use for creating connections to /// execute the query on.</param> public SelectRepeatableQuestsQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { QueryAsserts.ContainsColumns(QuestTable.DbColumns, "id", "repeatable"); }
/// <summary> /// Initializes a new instance of the <see cref="SetAccountCurrentIPsNullQuery"/> class. /// </summary> /// <param name="connectionPool">The connection pool.</param> public SetAccountCurrentIPsNullQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { }
/// <summary> /// Initializes a new instance of the <see cref="DbQueryReader"/> class. /// </summary> /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param> public SelectQuestIDsQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { QueryAsserts.ArePrimaryKeys(QuestTable.DbKeyColumns, "id"); }
/// <summary> /// Initializes a new instance of the <see cref="SelectShopIDsQuery"/> class. /// </summary> /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param> public SelectShopIDsQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { }
/// <summary> /// DbQueryNonReader constructor. /// </summary> /// <param name="connectionPool">DbConnectionPool to use for creating connections to execute the query on.</param> public UpdateServerTimeQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { }
/// <summary> /// Initializes a new instance of the <see cref="SelectCharacterTemplateIDsQuery"/> class. /// </summary> /// <param name="connectionPool">The connection pool.</param> public SelectCharacterTemplateIDsQuery(DbConnectionPool connectionPool) : base(connectionPool, CreateQuery(connectionPool.QueryBuilder)) { QueryAsserts.ArePrimaryKeys(CharacterTemplateTable.DbKeyColumns, "id"); }