Module: SQLite::Pragmas

Module SQLite::Pragmas |
In: | lib/sqlite/pragmas.rb

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

Two pragmas that have been intentionally excluded are SHOW_DATATYPES and EMPTY_RESULT_SETS, since these apply only to queries that use the SQLite "exec" function. The SQLite API does not employ that function, preferring instead the compile/step/finalize interface.

However, if you really must have those pragmas, you can always execute a pragma as if it were an SQL statement.

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

Methods

- 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=
- synchronous
- synchronous=
- table_info
- temp_store
- temp_store=
- vdbe_trace
- vdbe_trace=

Constants

SYNCHRONOUS_MODES | = | [ [ 'full', 2 ], [ 'normal', 1 ], [ 'off', 0 ] ]
| The enumeration of valid synchronous modes.
TEMP_STORE_MODES | = | [ [ 'default', 0 ], [ 'file', 1 ], [ 'memory', 2 ] ]
| The enumeration of valid temp store modes.

Public Instance methods
cache_size()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 142
    142:     def cache_size
    143:       get_int_pragma "cache_size"
    144:     end

cache_size=( size )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 146
    146:     def cache_size=( size )
    147:       set_int_pragma "cache_size", size
    148:     end

database_list( ) {|row| ...}

[ show source ]

         # File lib/sqlite/pragmas.rb, line 214
    214:     def database_list( &block ) # :yields: row
    215:       get_query_pragma "database_list", &block
    216:     end

default_cache_size()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 150
    150:     def default_cache_size
    151:       get_int_pragma "default_cache_size"
    152:     end

default_cache_size=( size )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 154
    154:     def default_cache_size=( size )
    155:       set_int_pragma "default_cache_size", size
    156:     end

default_synchronous()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 158
    158:     def default_synchronous
    159:       get_enum_pragma "default_synchronous"
    160:     end

default_synchronous=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 162
    162:     def default_synchronous=( mode )
    163:       set_enum_pragma "default_synchronous", mode, SYNCHRONOUS_MODES
    164:     end

default_temp_store()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 174
    174:     def default_temp_store
    175:       get_enum_pragma "default_temp_store"
    176:     end

default_temp_store=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 178
    178:     def default_temp_store=( mode )
    179:       set_enum_pragma "default_temp_store", mode, TEMP_STORE_MODES
    180:     end

foreign_key_list( table ) {|row| ...}

[ show source ]

         # File lib/sqlite/pragmas.rb, line 218
    218:     def foreign_key_list( table, &block ) # :yields: row
    219:       get_query_pragma "foreign_key_list", table, &block
    220:     end

full_column_names()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 190
    190:     def full_column_names
    191:       get_boolean_pragma "full_column_names"
    192:     end

full_column_names=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 194
    194:     def full_column_names=( mode )
    195:       set_boolean_pragma "full_column_names", mode
    196:     end

index_info( index ) {|row| ...}

[ show source ]

         # File lib/sqlite/pragmas.rb, line 222
    222:     def index_info( index, &block ) # :yields: row
    223:       get_query_pragma "index_info", index, &block
    224:     end

index_list( table ) {|row| ...}

[ show source ]

         # File lib/sqlite/pragmas.rb, line 226
    226:     def index_list( table, &block ) # :yields: row
    227:       get_query_pragma "index_list", table, &block
    228:     end

integrity_check()

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

[ show source ]

         # File lib/sqlite/pragmas.rb, line 136
    136:     def integrity_check
    137:       execute( "PRAGMA integrity_check" ) do |row|
    138:         raise Exceptions::DatabaseException, row[0] if row[0] != "ok"
    139:       end
    140:     end

parser_trace()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 198
    198:     def parser_trace
    199:       get_boolean_pragma "parser_trace"
    200:     end

parser_trace=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 202
    202:     def parser_trace=( mode )
    203:       set_boolean_pragma "parser_trace", mode
    204:     end

synchronous()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 166
    166:     def synchronous
    167:       get_enum_pragma "synchronous"
    168:     end

synchronous=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 170
    170:     def synchronous=( mode )
    171:       set_enum_pragma "synchronous", mode, SYNCHRONOUS_MODES
    172:     end

table_info( table ) {|row| ...}

[ show source ]

         # File lib/sqlite/pragmas.rb, line 230
    230:     def table_info( table, &block ) # :yields: row
    231:       get_query_pragma "table_info", table, &block
    232:     end

temp_store()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 182
    182:     def temp_store
    183:       get_enum_pragma "temp_store"
    184:     end

temp_store=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 186
    186:     def temp_store=( mode )
    187:       set_enum_pragma "temp_store", mode, TEMP_STORE_MODES
    188:     end

vdbe_trace()

[ show source ]

         # File lib/sqlite/pragmas.rb, line 206
    206:     def vdbe_trace
    207:       get_boolean_pragma "vdbe_trace"
    208:     end

vdbe_trace=( mode )

[ show source ]

         # File lib/sqlite/pragmas.rb, line 210
    210:     def vdbe_trace=( mode )
    211:       set_boolean_pragma "vdbe_trace", mode
    212:     end

[Validate]