Skip to content

Commit

Permalink
DDL transactions and savepoints for sqlite
Browse files Browse the repository at this point in the history
Sqlite has had DDL transactions since 2.0.0[1] and savepoints since
3.6.8[2].  This patch updates the connection_adapters.

[1] http://tinyurl.com/sqlite-v2-0-0
[2] http://tinyurl.com/sqlite-v3-6-8

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2080 state:committed]
  • Loading branch information
smathy authored and NZKoz committed Mar 2, 2009
1 parent 04fdb6e commit 38136f8
Showing 1 changed file with 20 additions and 1 deletion.
Expand Up @@ -72,10 +72,29 @@ def binary_to_string(value)
#
# * <tt>:database</tt> - Path to the database file.
class SQLiteAdapter < AbstractAdapter

class Version
include Comparable
def initialize(vs)
@v = vs.split('.').map(&:to_i)
end
def <=>(rhs)
@v <=> rhs.split('.').map(&:to_i)
end
end

def adapter_name #:nodoc:
'SQLite'
end

def supports_ddl_transactions?
sqlite_version >= '2.0.0'
end

def supports_savepoints?
sqlite_version >= '3.6.8'
end

def supports_migrations? #:nodoc:
true
end
Expand Down Expand Up @@ -380,7 +399,7 @@ def catch_schema_changes
end

def sqlite_version
@sqlite_version ||= select_value('select sqlite_version(*)')
@sqlite_version ||= SQLiteAdapter::Version.new(select_value('select sqlite_version(*)'))
end

def default_primary_key_type
Expand Down

0 comments on commit 38136f8

Please sign in to comment.