Update vendored Sqlite3-ruby to 1.3.0

Also, some tweaks to Maruku.
This commit is contained in:
Jacques Distler 2010-06-10 22:42:33 -05:00
parent 9a80cacc34
commit 4f8759cdf3
55 changed files with 3071 additions and 8028 deletions

View file

@ -213,16 +213,24 @@ module SQLite3
get_query_pragma "index_list", table, &block
end
def table_info( table, &block ) # :yields: row
columns, *rows = execute2("PRAGMA table_info(#{table})")
###
# Returns information about +table+. Yields each row of table information
# if a block is provided.
def table_info table
stmt = prepare "PRAGMA table_info(#{table})"
columns = stmt.columns
needs_tweak_default = version_compare(driver.libversion, "3.3.7") > 0
needs_tweak_default =
version_compare(SQLite3.libversion.to_s, "3.3.7") > 0
result = [] unless block_given?
rows.each do |row|
new_row = {}
columns.each_with_index do |name, index|
new_row[name] = row[index]
stmt.each do |row|
new_row = Hash[*columns.zip(row).flatten]
# 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
@ -233,6 +241,7 @@ module SQLite3
result << new_row
end
end
stmt.close
result
end