Class: DBI::DBD::SQLite

Inherits:
Object
  • Object
show all
Defined in:
lib/dbd/SQLite.rb

Overview

DBD::SQLite - Database Driver for SQLite versions 2.x and lower.

Requires DBI and the ‘sqlite-ruby’ gem to work.

Only things that extend DBI’s results are documented.

Defined Under Namespace

Classes: Database, Driver, Statement

Constant Summary collapse

VERSION =
"0.1.2"
DESCRIPTION =
"SQLite 2.x DBI DBD"

Class Method Summary collapse

Class Method Details

.check_sql(sql) ⇒ Object

Validates that the SQL has no literal NUL characters. (ASCII 0)

SQLite apparently really hates it when you do that.

It will raise DBI::DatabaseError should it find any.

Raises:



58
59
60
61
62
# File 'lib/dbd/SQLite.rb', line 58

def self.check_sql(sql)
    # XXX I'm starting to think this is less of a problem with SQLite
    # and more with the old C DBD
    raise DBI::DatabaseError, "Bad SQL: SQL cannot contain nulls" if sql =~ /\0/
end

.driver_nameObject

returns ‘SQLite’

See DBI::TypeUtil#convert for more information.



47
48
49
# File 'lib/dbd/SQLite.rb', line 47

def self.driver_name
    "SQLite"
end

.parse_type(type_name) ⇒ Object

Split a type definition into parts via String#match and return the whole result.



67
68
69
# File 'lib/dbd/SQLite.rb', line 67

def self.parse_type(type_name)
    type_name.match(/^([^\(]+)(\((\d+)(,(\d+))?\))?$/)
end