示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteTableOrView" /> class.
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="tableOrViewName"></param>
 /// <param name="whereClause"></param>
 /// <param name="argumentValue"></param>
 public SQLiteTableOrView(SQLiteDataSourceBase dataSource, SQLiteObjectName tableOrViewName, string whereClause, object argumentValue) :
     base(dataSource)
 {
     m_ArgumentValue = argumentValue;
     m_WhereClause   = whereClause;
     m_Table         = dataSource.DatabaseMetadata.GetTableOrView(tableOrViewName);
 }
示例#2
0
        //public object MetadataCache { get; private set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteTableOrView" /> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="tableOrViewName">Name of the table or view.</param>
        /// <param name="filterValue">The filter value.</param>
        /// <param name="filterOptions">The filter options.</param>
        public SQLiteTableOrView(SQLiteDataSourceBase dataSource, SQLiteObjectName tableOrViewName, object filterValue, FilterOptions filterOptions = FilterOptions.None) :
            base(dataSource)
        {
            m_FilterValue   = filterValue;
            m_FilterOptions = filterOptions;
            m_Table         = dataSource.DatabaseMetadata.GetTableOrView(tableOrViewName);
        }
示例#3
0
    /// <summary>
    /// Initializes a new instance of the <see cref="SQLiteDeleteSet" /> class.
    /// </summary>
    /// <param name="dataSource">The data source.</param>
    /// <param name="tableName">Name of the table.</param>
    /// <param name="whereClause">The where clause.</param>
    /// <param name="parameters">The parameters.</param>
    /// <param name="expectedRowCount">The expected row count.</param>
    /// <param name="options">The options.</param>
    public SQLiteDeleteSet(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, string whereClause, IEnumerable <SQLiteParameter> parameters, int?expectedRowCount, DeleteOptions options) : base(dataSource, whereClause, parameters, expectedRowCount, options)
    {
        if (options.HasFlag(DeleteOptions.UseKeyAttribute))
        {
            throw new NotSupportedException("Cannot use Key attributes with this operation.");
        }

        m_Table = dataSource.DatabaseMetadata.GetTableOrView(tableName);
    }
示例#4
0
 private SQLiteColumnStatement GetColumnFromTable(SQLiteObjectName name, List <SQLiteColumnStatement> clist)
 {
     foreach (SQLiteColumnStatement col in clist)
     {
         if (col.ObjectName.Equals(name))
         {
             return(col);
         }
     } // foreach
     return(null);
 }
示例#5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteUpdateMany" /> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="newValues">The new values.</param>
        /// <param name="options">The options.</param>
        /// <exception cref="System.NotSupportedException">Cannot use Key attributes with this operation.</exception>
        public SQLiteUpdateMany(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, object?newValues, UpdateOptions options) : base(dataSource)
        {
            if (options.HasFlag(UpdateOptions.UseKeyAttribute))
            {
                throw new NotSupportedException("Cannot use Key attributes with this operation.");
            }

            m_Table     = dataSource.DatabaseMetadata.GetTableOrView(tableName);
            m_NewValues = newValues;
            m_Options   = options;
        }
示例#6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteUpdateMany" /> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="updateExpression">The update expression.</param>
        /// <param name="updateArgumentValue">The update argument value.</param>
        /// <param name="options">The options.</param>
        /// <exception cref="System.NotSupportedException">Cannot use Key attributes with this operation.</exception>
        public SQLiteUpdateMany(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, string updateExpression, object?updateArgumentValue, UpdateOptions options) : base(dataSource)
        {
            if (options.HasFlag(UpdateOptions.UseKeyAttribute))
            {
                throw new NotSupportedException("Cannot use Key attributes with this operation.");
            }

            m_Table               = dataSource.DatabaseMetadata.GetTableOrView(tableName);
            m_UpdateExpression    = updateExpression;
            m_Options             = options;
            m_UpdateArgumentValue = updateArgumentValue;
        }
示例#7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteDeleteMany" /> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="whereClause">The where clause.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="options">The options.</param>
        public SQLiteDeleteMany(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, string whereClause, IEnumerable <SQLiteParameter> parameters, DeleteOptions options) : base(dataSource)
        {
            if (options.HasFlag(DeleteOptions.UseKeyAttribute))
            {
                throw new NotSupportedException("Cannot use Key attributes with this operation.");
            }

            m_Table       = dataSource.DatabaseMetadata.GetTableOrView(tableName);
            m_WhereClause = whereClause;
            //m_Options = options;
            m_Parameters = parameters;
        }
示例#8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SQLiteUpdateMany" /> class.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="tableName">Name of the table.</param>
        /// <param name="newValues">The new values.</param>
        /// <param name="whereClause">The where clause.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="expectedRowCount">The expected row count.</param>
        /// <param name="options">The options.</param>
        public SQLiteUpdateMany(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, object?newValues, string whereClause, IEnumerable <SQLiteParameter> parameters, int?expectedRowCount, UpdateOptions options) : base(dataSource)
        {
            if (options.HasFlag(UpdateOptions.UseKeyAttribute))
            {
                throw new NotSupportedException("Cannot use Key attributes with this operation.");
            }

            m_Table            = dataSource.DatabaseMetadata.GetTableOrView(tableName);
            m_NewValues        = newValues;
            m_WhereClause      = whereClause;
            m_ExpectedRowCount = expectedRowCount;
            m_Options          = options;
            m_Parameters       = parameters;
        }
示例#9
0
        public SQLiteInsertBatch(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, IEnumerable <TObject> objects, InsertOptions options) : base(dataSource)
        {
            if (dataSource == null)
            {
                throw new ArgumentNullException(nameof(dataSource), $"{nameof(dataSource)} is null.");
            }

            var sourceList = objects.AsReadOnlyList();

            if (sourceList == null || sourceList.Count == 0)
            {
                throw new ArgumentException($"{nameof(objects)} is null or empty.", nameof(objects));
            }

            m_SourceList = sourceList;
            m_Options    = options;
            m_Table      = dataSource.DatabaseMetadata.GetTableOrView(tableName);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteInsertOrUpdateObject{TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="tableName"></param>
 /// <param name="argumentValue"></param>
 /// <param name="options"></param>
 public SQLiteInsertOrUpdateObject(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, TArgument argumentValue, UpsertOptions options)
     : base(dataSource, tableName, argumentValue)
 {
     m_Options = options;
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteObjectCommand{TArgument}" /> class
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="argumentValue">The argument value.</param>
 protected SQLiteObjectCommand(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, TArgument argumentValue)
     : base(dataSource, argumentValue)
 {
     Table = dataSource.DatabaseMetadata.GetTableOrView(tableName);
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDeleteObject{TArgument}"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">The table.</param>
 /// <param name="argumentValue">The argument value.</param>
 /// <param name="options">The options.</param>
 public SQLiteDeleteObject(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, TArgument argumentValue, DeleteOptions options)
     : base(dataSource, tableName, argumentValue)
 {
     m_Options = options;
 }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDeleteMany"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="filterValue">The filter value.</param>
 /// <param name="filterOptions">The options.</param>
 public SQLiteDeleteMany(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, object filterValue, FilterOptions filterOptions) : base(dataSource)
 {
     m_Table         = dataSource.DatabaseMetadata.GetTableOrView(tableName);
     m_FilterValue   = filterValue;
     m_FilterOptions = filterOptions;
 }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SQLiteDeleteSet"/> class.
 /// </summary>
 /// <param name="dataSource">The data source.</param>
 /// <param name="tableName">Name of the table.</param>
 /// <param name="whereClause">The where clause.</param>
 /// <param name="argumentValue">The argument value.</param>
 public SQLiteDeleteSet(SQLiteDataSourceBase dataSource, SQLiteObjectName tableName, string whereClause, object?argumentValue) : base(dataSource, whereClause, argumentValue)
 {
     m_Table = dataSource.DatabaseMetadata.GetTableOrView(tableName);
 }