コード例 #1
0
        internal CUpdateQuery(CDataBase p_data_base, CObjectMap p_map, String p_table_name, SQL.CAssignmentList p_assignments, SQL.CWhereCondition p_update_condition)
            : base(p_data_base)
        {
            if (p_map == null)
            {
                throw new ArgumentNullException("You must specify an object map to use.");
            }
            if (p_table_name == null)
            {
                throw new ArgumentNullException("You must specify a table name to use.");
            }
            if (String.IsNullOrWhiteSpace(p_table_name))
            {
                throw new ArgumentException("The specified table name may not consist only of whitespace.");
            }
            if (p_assignments == null)
            {
                throw new ArgumentNullException("You must specify assignments to use for the query.");
            }

            m_p_table_name       = p_table_name;
            m_p_assignments      = p_assignments;
            m_p_update_condition = p_update_condition;
            _m_p_map             = p_map;
        }
コード例 #2
0
        /// <summary>
        /// Constructs a new select query with the given properties.
        /// </summary>
        /// <param name="p_data_base">The database the query is supposed to run against.</param>
        /// <param name="p_map">The object map the query is created for.</param>
        /// <param name="p_column_names">The columns that should be extracted by the query.</param>
        /// <param name="p_table_name">The name of the table this query should extract data from.</param>
        /// <param name="p_where_condition">The conditions that rows must satisfy to be matched in this query, or null if there should be no conditions.</param>
        internal CSelectQuery(CDataBase p_data_base, CObjectMap p_map, String p_table_name, String[] p_column_names, SQL.CWhereCondition p_where_condition)
            : base(p_data_base)
        {
            if (p_map == null)
            {
                throw new ArgumentNullException("You must specify a map to use.");
            }
            if (p_table_name == null)
            {
                throw new ArgumentNullException("You must specify a table name to use.");
            }
            if (String.IsNullOrWhiteSpace(p_table_name))
            {
                throw new ArgumentException("The specified table name may not consist only of whitespace.");
            }
            if (p_column_names == null)
            {
                throw new ArgumentNullException("You must provide column names to use.");
            }

            m_p_columns         = new ReadOnlyCollection <String>((IList <String>)p_column_names.Clone());
            m_p_table_name      = p_table_name;
            m_p_where_condition = p_where_condition;

            _m_p_map = p_map;
        }
コード例 #3
0
        /// <summary>
        /// Constructs a new delete query to delete columns matching the given condition from the given table.
        /// </summary>
        /// <param name="p_data_base">The database the query should be run against.</param>
        /// <param name="p_map">The object map this query is being created for.</param>
        /// <param name="p_table_name">The name of the table to delete rows from.</param>
        /// <param name="p_where_condition">The condition a row must satisfy to be deleted.</param>
        /// <param name="limit">The total number of rows to delete, or 0 if every matched row should be deleted.</param>
        internal CDeleteQuery(CDataBase p_data_base, CObjectMap p_map, String p_table_name, SQL.CWhereCondition p_where_condition, UInt64 limit)
            : base(p_data_base)
        {
            if (p_map == null)
            {
                throw new ArgumentNullException("The map may not be null.");
            }
            if (p_table_name == null)
            {
                throw new ArgumentNullException("You must specify a table name to use.");
            }
            if (String.IsNullOrWhiteSpace(p_table_name))
            {
                throw new ArgumentException("The specified table name may not consist only of whitespace.");
            }

            m_p_table_name      = p_table_name;
            m_p_where_condition = p_where_condition;

            m_limit = limit;

            _m_p_map = p_map;
        }