コード例 #1
0
 internal KeyQuery(SQLiteConnection cnn, string database, string table, params string[] columns)
 {
     using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
     {
         _command = cnn.CreateCommand();
         for (int n = 0; n < columns.Length; n++)
         {
             columns[n] = builder.QuoteIdentifier(columns[n]);
         }
     }
     _command.CommandText = String.Format(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table);
     _command.Parameters.AddWithValue(null, (long)0);
 }
コード例 #2
0
    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter with the supplied select command text and
    /// associated with the specified connection.
    /// </summary>
    /// <param name="commandText">
    /// The select command text to associate with the data adapter.
    /// </param>
    /// <param name="connection">
    /// The connection to associate with the select command.
    /// </param>
    public SQLiteDataAdapter(string commandText, SQLiteConnection connection)
    {
      SelectCommand = new SQLiteCommand(commandText, connection);
    }
コード例 #3
0
    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter using the specified select command.
    /// </summary>
    /// <param name="cmd">
    /// The select command to associate with the adapter.
    /// </param>
    public SQLiteDataAdapter(SQLiteCommand cmd)
    {
      SelectCommand = cmd;
      disposeSelect = false;
    }
コード例 #4
0
    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter with the specified select command text,
    /// and using the specified database connection string.
    /// </summary>
    /// <param name="commandText">
    /// The select command text to use to construct a select command.
    /// </param>
    /// <param name="connectionString">
    /// A connection string suitable for passing to a new SQLiteConnection,
    /// which is associated with the select command.
    /// </param>
    /// <param name="parseViaFramework">
    /// Non-zero to parse the connection string using the built-in (i.e.
    /// framework provided) parser when opening the connection.
    /// </param>
    public SQLiteDataAdapter(
        string commandText,
        string connectionString,
        bool parseViaFramework
        )
    {
      SQLiteConnection cnn = new SQLiteConnection(
          connectionString, parseViaFramework);

      SelectCommand = new SQLiteCommand(commandText, cnn);
    }
コード例 #5
0
ファイル: SQLiteCommand.cs プロジェクト: rohitlodha/DenverDB
    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method attempts to query the flags associated with the database
    /// connection in use.  If the database connection is disposed, the default
    /// flags will be returned.
    /// </summary>
    /// <param name="command">
    /// The command containing the databse connection to query the flags from.
    /// </param>
    /// <returns>
    /// The connection flags value.
    /// </returns>
    internal static SQLiteConnectionFlags GetFlags(
        SQLiteCommand command
        )
    {
        try
        {
            if (command != null)
            {
                SQLiteConnection cnn = command._cnn;

                if (cnn != null)
                    return cnn.Flags;
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnectionFlags.Default;
    }
コード例 #6
0
ファイル: SQLiteCommand.cs プロジェクト: rohitlodha/DenverDB
    internal static void Check(SQLiteCommand command)
    {
        if (command == null)
            throw new ArgumentNullException("command");

        command.CheckDisposed();
        SQLiteConnection.Check(command._cnn);
    }
コード例 #7
0
ファイル: SQLiteCommand.cs プロジェクト: rohitlodha/DenverDB
    private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction)
    {
      CommandTimeout = source.CommandTimeout;
      DesignTimeVisible = source.DesignTimeVisible;
      UpdatedRowSource = source.UpdatedRowSource;

      foreach (SQLiteParameter param in source._parameterCollection)
      {
        Parameters.Add(param.Clone());
      }
    }
コード例 #8
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    IsValid = false;

                    if (_command != null) _command.Dispose();
                    _command = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
コード例 #9
0
 /// <summary>
 /// Initializes the collection
 /// </summary>
 /// <param name="cmd">The command to which the collection belongs</param>
 internal SQLiteParameterCollection(SQLiteCommand cmd)
 {
   _command = cmd;
   _parameterList = new List<SQLiteParameter>();
   _unboundFlag = true;
 }