Module: SQLite3::Pragmas

### Home Classes Methods

### In Files

- lib/sqlite3/pragmas.rb

### Methods

- #auto_vacuum
- #auto_vacuum=
- #cache_size
- #cache_size=
- #database_list
- #default_cache_size
- #default_cache_size=
- #default_synchronous
- #default_synchronous=
- #default_temp_store
- #default_temp_store=
- #foreign_key_list
- #full_column_names
- #full_column_names=
- #index_info
- #index_list
- #integrity_check
- #parser_trace
- #parser_trace=
- #schema_cookie
- #schema_cookie=
- #synchronous
- #synchronous=
- #table_info
- #temp_store
- #temp_store=
- #user_cookie
- #user_cookie=
- #vdbe_trace
- #vdbe_trace=

### Files

- API_CHANGES.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- SQLite3
- SQLite3::AbortException
- SQLite3::AuthorizationException
- SQLite3::Backup
- SQLite3::Blob
- SQLite3::BusyException
- SQLite3::CantOpenException
- SQLite3::Constants
- SQLite3::Constants::ColumnType
- SQLite3::Constants::ErrorCode
- SQLite3::Constants::TextRep
- SQLite3::ConstraintException
- SQLite3::CorruptException
- SQLite3::Database
- SQLite3::Database::FunctionProxy
- SQLite3::EmptyException
- SQLite3::Exception
- SQLite3::FormatException
- SQLite3::FullException
- SQLite3::IOException
- SQLite3::InternalException
- SQLite3::InterruptException
- SQLite3::LockedException
- SQLite3::MemoryException
- SQLite3::MismatchException
- SQLite3::MisuseException
- SQLite3::NotADatabaseException
- SQLite3::NotFoundException
- SQLite3::PermissionException
- SQLite3::Pragmas
- SQLite3::ProtocolException
- SQLite3::RangeException
- SQLite3::ReadOnlyException
- SQLite3::ResultSet
- SQLite3::SQLException
- SQLite3::SchemaChangedException
- SQLite3::Statement
- SQLite3::TooBigException
- SQLite3::Translator
- SQLite3::UnsupportedException
- SQLite3::Value
- SQLite3::VersionProxy
- String

No matching classes.

# SQLite3::Pragmas

This module is intended for inclusion solely by the Database class. It defines convenience methods for the various pragmas supported by SQLite3.

For a detailed description of these pragmas, see the SQLite3 documentation at sqlite.org/pragma.html.

### Constants

SYNCHRONOUS_MODES

  The enumeration of valid synchronous modes.

TEMP_STORE_MODES

  The enumeration of valid temp store modes.

### Public Instance Methods

auto_vacuum() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 104
    def auto_vacuum
      get_boolean_pragma "auto_vacuum"
    end

auto_vacuum=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 108
    def auto_vacuum=( mode )
      set_boolean_pragma "auto_vacuum", mode
    end

cache_size() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 128
    def cache_size
      get_int_pragma "cache_size"
    end

cache_size=( size ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 132
    def cache_size=( size )
      set_int_pragma "cache_size", size
    end

database_list( ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 200
    def database_list( &block ) # :yields: row
      get_query_pragma "database_list", &block
    end

default_cache_size() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 136
    def default_cache_size
      get_int_pragma "default_cache_size"
    end

default_cache_size=( size ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 140
    def default_cache_size=( size )
      set_int_pragma "default_cache_size", size
    end

default_synchronous() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 144
    def default_synchronous
      get_enum_pragma "default_synchronous"
    end

default_synchronous=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 148
    def default_synchronous=( mode )
      set_enum_pragma "default_synchronous", mode, SYNCHRONOUS_MODES
    end

default_temp_store() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 160
    def default_temp_store
      get_enum_pragma "default_temp_store"
    end

default_temp_store=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 164
    def default_temp_store=( mode )
      set_enum_pragma "default_temp_store", mode, TEMP_STORE_MODES
    end

foreign_key_list( table ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 204
    def foreign_key_list( table, &block ) # :yields: row
      get_query_pragma "foreign_key_list", table, &block
    end

full_column_names() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 176
    def full_column_names
      get_boolean_pragma "full_column_names"
    end

full_column_names=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 180
    def full_column_names=( mode )
      set_boolean_pragma "full_column_names", mode
    end

index_info( index ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 208
    def index_info( index, &block ) # :yields: row
      get_query_pragma "index_info", index, &block
    end

index_list( table ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 212
    def index_list( table, &block ) # :yields: row
      get_query_pragma "index_list", table, &block
    end

integrity_check() click to toggle source

Does an integrity check on the database. If the check fails, a SQLite3::Exception will be raised. Otherwise it returns silently.

    # File lib/sqlite3/pragmas.rb, line 98
    def integrity_check
      execute( "PRAGMA integrity_check" ) do |row|
        raise Exception, row[0] if row[0] != "ok"
      end
    end

parser_trace() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 184
    def parser_trace
      get_boolean_pragma "parser_trace"
    end

parser_trace=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 188
    def parser_trace=( mode )
      set_boolean_pragma "parser_trace", mode
    end

schema_cookie() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 112
    def schema_cookie
      get_int_pragma "schema_cookie"
    end

schema_cookie=( cookie ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 116
    def schema_cookie=( cookie )
      set_int_pragma "schema_cookie", cookie
    end

synchronous() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 152
    def synchronous
      get_enum_pragma "synchronous"
    end

synchronous=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 156
    def synchronous=( mode )
      set_enum_pragma "synchronous", mode, SYNCHRONOUS_MODES
    end

table_info(table) click to toggle source

Returns information about `table`. Yields each row of table information if a block is provided.

    # File lib/sqlite3/pragmas.rb, line 219
    def table_info table
      stmt    = prepare "PRAGMA table_info(#{table})"
      columns = stmt.columns

      needs_tweak_default =
        version_compare(SQLite3.libversion.to_s, "3.3.7") > 0

      result = [] unless block_given?
      stmt.each do |row|
        new_row = Hash[columns.zip(row)]

        # FIXME: This should be removed but is required for older versions
        # of rails
        if(Object.const_defined?(:ActiveRecord))
          new_row['notnull'] = new_row['notnull'].to_s
        end

        tweak_default(new_row) if needs_tweak_default

        if block_given?
          yield new_row
        else
          result << new_row
        end
      end
      stmt.close

      result
    end

temp_store() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 168
    def temp_store
      get_enum_pragma "temp_store"
    end

temp_store=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 172
    def temp_store=( mode )
      set_enum_pragma "temp_store", mode, TEMP_STORE_MODES
    end

user_cookie() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 120
    def user_cookie
      get_int_pragma "user_cookie"
    end

user_cookie=( cookie ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 124
    def user_cookie=( cookie )
      set_int_pragma "user_cookie", cookie
    end

vdbe_trace() click to toggle source

    # File lib/sqlite3/pragmas.rb, line 192
    def vdbe_trace
      get_boolean_pragma "vdbe_trace"
    end

vdbe_trace=( mode ) click to toggle source

    # File lib/sqlite3/pragmas.rb, line 196
    def vdbe_trace=( mode )
      set_boolean_pragma "vdbe_trace", mode
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.