amalgalite 1.1.2-x86-mswin32 → 1.3.0-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +49 -0
- data/{HISTORY.rdoc → HISTORY.md} +96 -73
- data/LICENSE +2 -2
- data/Manifest.txt +104 -0
- data/README.md +73 -0
- data/Rakefile +25 -0
- data/TODO.md +50 -0
- data/ext/amalgalite/{amalgalite3.c → c/amalgalite.c} +12 -12
- data/ext/amalgalite/{amalgalite3.h → c/amalgalite.h} +5 -5
- data/ext/amalgalite/{amalgalite3_blob.c → c/amalgalite_blob.c} +2 -2
- data/ext/amalgalite/{amalgalite3_constants.c → c/amalgalite_constants.c} +2 -2
- data/ext/amalgalite/{amalgalite3_database.c → c/amalgalite_database.c} +49 -21
- data/ext/amalgalite/{amalgalite3_requires_bootstrap.c → c/amalgalite_requires_bootstrap.c} +131 -58
- data/ext/amalgalite/{amalgalite3_statement.c → c/amalgalite_statement.c} +2 -2
- data/ext/amalgalite/{extconf.rb → c/extconf.rb} +4 -4
- data/ext/amalgalite/{gen_constants.rb → c/gen_constants.rb} +3 -3
- data/ext/amalgalite/c/notes.txt +134 -0
- data/ext/amalgalite/{sqlite3.c → c/sqlite3.c} +94602 -80497
- data/ext/amalgalite/{sqlite3.h → c/sqlite3.h} +1047 -216
- data/ext/amalgalite/{sqlite3_options.h → c/sqlite3_options.h} +0 -0
- data/ext/amalgalite/{sqlite3ext.h → c/sqlite3ext.h} +40 -13
- data/lib/amalgalite.rb +13 -6
- data/lib/amalgalite/1.8/amalgalite.so +0 -0
- data/lib/amalgalite/1.9/amalgalite.so +0 -0
- data/lib/amalgalite/2.0/amalgalite.so +0 -0
- data/lib/amalgalite/column.rb +7 -5
- data/lib/amalgalite/database.rb +18 -10
- data/lib/amalgalite/packer.rb +5 -2
- data/lib/amalgalite/requires.rb +47 -16
- data/lib/amalgalite/schema.rb +63 -36
- data/lib/amalgalite/sqlite3/version.rb +0 -1
- data/lib/amalgalite/statement.rb +7 -5
- data/lib/amalgalite/table.rb +9 -8
- data/lib/amalgalite/type_maps/default_map.rb +0 -1
- data/lib/amalgalite/type_maps/storage_map.rb +0 -2
- data/lib/amalgalite/type_maps/text_map.rb +0 -1
- data/lib/amalgalite/version.rb +3 -32
- data/spec/aggregate_spec.rb +1 -1
- data/spec/amalgalite_spec.rb +1 -1
- data/spec/blob_spec.rb +1 -1
- data/spec/boolean_spec.rb +2 -1
- data/spec/busy_handler.rb +1 -1
- data/spec/database_spec.rb +16 -11
- data/spec/default_map_spec.rb +1 -1
- data/spec/function_spec.rb +1 -1
- data/spec/integeration_spec.rb +2 -1
- data/spec/packer_spec.rb +4 -4
- data/spec/paths_spec.rb +1 -1
- data/spec/progress_handler_spec.rb +4 -5
- data/spec/requires_spec.rb +36 -2
- data/spec/rtree_spec.rb +6 -5
- data/spec/schema_spec.rb +28 -20
- data/spec/spec_helper.rb +2 -7
- data/spec/sqlite3/constants_spec.rb +1 -1
- data/spec/sqlite3/database_status_spec.rb +4 -4
- data/spec/sqlite3/status_spec.rb +5 -5
- data/spec/sqlite3/version_spec.rb +7 -7
- data/spec/sqlite3_spec.rb +3 -3
- data/spec/statement_spec.rb +3 -4
- data/spec/storage_map_spec.rb +1 -1
- data/spec/tap_spec.rb +4 -4
- data/spec/text_map_spec.rb +1 -1
- data/spec/type_map_spec.rb +1 -1
- data/spec/version_spec.rb +2 -9
- data/tasks/custom.rake +99 -0
- data/tasks/default.rake +277 -0
- data/tasks/extension.rake +28 -202
- data/tasks/this.rb +209 -0
- metadata +102 -191
- data/README.rdoc +0 -54
- data/gemspec.rb +0 -63
- data/lib/amalgalite/1.8/amalgalite3.so +0 -0
- data/lib/amalgalite/1.9/amalgalite3.so +0 -0
- data/tasks/announce.rake +0 -44
- data/tasks/config.rb +0 -107
- data/tasks/distribution.rake +0 -77
- data/tasks/documentation.rake +0 -36
- data/tasks/rspec.rake +0 -30
- data/tasks/utils.rb +0 -80
data/lib/amalgalite/statement.rb
CHANGED
@@ -103,9 +103,10 @@ module Amalgalite
|
|
103
103
|
end
|
104
104
|
ensure
|
105
105
|
s = $!
|
106
|
-
begin
|
106
|
+
begin
|
107
107
|
reset_for_next_execute!
|
108
|
-
rescue
|
108
|
+
rescue
|
109
|
+
# rescuing nothing on purpose
|
109
110
|
end
|
110
111
|
raise s if s != s_before
|
111
112
|
end
|
@@ -343,9 +344,10 @@ module Amalgalite
|
|
343
344
|
column_meta.schema = ::Amalgalite::Column.new( db_name, tbl_name, col_name, idx )
|
344
345
|
column_meta.schema.declared_data_type = @stmt_api.column_declared_type( idx )
|
345
346
|
|
346
|
-
# only check for rowid if we have a table name and it is not the
|
347
|
-
# sqlite_master
|
348
|
-
if not using_rowid_column? and tbl_name and
|
347
|
+
# only check for rowid if we have a table name and it is not one of the
|
348
|
+
# sqlite_master tables. We could get recursion in those cases.
|
349
|
+
if not using_rowid_column? and tbl_name and
|
350
|
+
not %w[ sqlite_master sqlite_temp_master].include?( tbl_name ) and is_column_rowid?( tbl_name, col_name ) then
|
349
351
|
@rowid_index = idx
|
350
352
|
end
|
351
353
|
|
data/lib/amalgalite/table.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
require 'set'
|
6
6
|
module Amalgalite
|
7
7
|
#
|
8
|
-
# a class representing the meta information about an SQLite table
|
8
|
+
# a class representing the meta information about an SQLite table
|
9
9
|
#
|
10
10
|
class Table
|
11
11
|
# the schema object the table is associated with
|
@@ -25,19 +25,20 @@ module Amalgalite
|
|
25
25
|
# in this table. keys are the column names
|
26
26
|
attr_accessor :columns
|
27
27
|
|
28
|
-
def initialize( name, sql = nil )
|
29
|
-
@name
|
30
|
-
@sql
|
31
|
-
@indexes
|
32
|
-
@columns
|
28
|
+
def initialize( name, sql = nil )
|
29
|
+
@name = name
|
30
|
+
@sql = sql
|
31
|
+
@indexes = {}
|
32
|
+
@columns = {}
|
33
|
+
@schema = nil
|
34
|
+
@primary_key = nil
|
33
35
|
end
|
34
36
|
|
35
37
|
# Is the table a temporary table or not
|
36
38
|
def temporary?
|
37
|
-
|
39
|
+
schema.temporary?
|
38
40
|
end
|
39
41
|
|
40
|
-
|
41
42
|
# the Columns in original definition order
|
42
43
|
def columns_in_order
|
43
44
|
@columns.values.sort_by { |c| c.order }
|
data/lib/amalgalite/version.rb
CHANGED
@@ -1,37 +1,8 @@
|
|
1
1
|
#--
|
2
2
|
# Copyright (c) 2008 Jeremy Hinegardner
|
3
|
-
# All rights reserved. See LICENSE and/or COPYING for
|
3
|
+
# All rights reserved. See LICENSE and/or COPYING for licensing details
|
4
4
|
#++
|
5
5
|
|
6
6
|
module Amalgalite
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
MAJOR = 1
|
11
|
-
MINOR = 1
|
12
|
-
BUILD = 2
|
13
|
-
|
14
|
-
#
|
15
|
-
# return the Version as an array of MAJOR, MINOR, BUILD
|
16
|
-
#
|
17
|
-
def self.to_a
|
18
|
-
[MAJOR, MINOR, BUILD]
|
19
|
-
end
|
20
|
-
|
21
|
-
# return the Version as a dotted String MAJOR.MINOR.BUILD
|
22
|
-
def self.to_s
|
23
|
-
to_a.join(".")
|
24
|
-
end
|
25
|
-
|
26
|
-
# return the Vesion as a hash
|
27
|
-
def self.to_hash
|
28
|
-
{ :major => MAJOR, :minor => MINOR, :build => BUILD }
|
29
|
-
end
|
30
|
-
|
31
|
-
# Version string constant
|
32
|
-
STRING = Version.to_s.freeze
|
33
|
-
end
|
34
|
-
|
35
|
-
# Version string constant
|
36
|
-
VERSION = Version.to_s.freeze
|
37
|
-
end
|
7
|
+
VERSION = "1.3.0"
|
8
|
+
end
|
data/spec/aggregate_spec.rb
CHANGED
data/spec/amalgalite_spec.rb
CHANGED
data/spec/blob_spec.rb
CHANGED
data/spec/boolean_spec.rb
CHANGED
data/spec/busy_handler.rb
CHANGED
data/spec/database_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
require 'thread'
|
4
4
|
require 'amalgalite'
|
5
5
|
require 'amalgalite/taps/io'
|
6
6
|
require 'amalgalite/taps/console'
|
@@ -222,7 +222,7 @@ describe Amalgalite::Database do
|
|
222
222
|
db.in_transaction?.should eql(true)
|
223
223
|
raise "testing rollback"
|
224
224
|
end
|
225
|
-
rescue
|
225
|
+
rescue
|
226
226
|
@iso_db.in_transaction?.should eql(false)
|
227
227
|
@iso_db.execute("SELECT count(1) as cnt FROM country").first['cnt'].should eql(242)
|
228
228
|
end
|
@@ -260,23 +260,23 @@ describe Amalgalite::Database do
|
|
260
260
|
|
261
261
|
describe "#define_function" do
|
262
262
|
it "does not allow mixing of arbitrary and mandatory arguments to an SQL function" do
|
263
|
-
class
|
263
|
+
class DBFunctionTest2 < ::Amalgalite::Function
|
264
264
|
def initialize
|
265
265
|
super( 'ftest2', -2 )
|
266
266
|
end
|
267
267
|
def call( a, *args ); end
|
268
268
|
end
|
269
|
-
lambda { @iso_db.define_function("ftest2",
|
269
|
+
lambda { @iso_db.define_function("ftest2", DBFunctionTest2.new ) }.should raise_error( ::Amalgalite::Database::FunctionError )
|
270
270
|
end
|
271
271
|
|
272
272
|
it "does not allow outrageous arity" do
|
273
|
-
class
|
273
|
+
class DBFunctionTest3 < ::Amalgalite::Function
|
274
274
|
def initialize
|
275
275
|
super( 'ftest3', 128 )
|
276
276
|
end
|
277
277
|
def call( *args) ; end
|
278
278
|
end
|
279
|
-
lambda { @iso_db.define_function("ftest3",
|
279
|
+
lambda { @iso_db.define_function("ftest3", DBFunctionTest3.new ) }.should raise_error( ::Amalgalite::SQLite3::Error )
|
280
280
|
end
|
281
281
|
|
282
282
|
end
|
@@ -364,7 +364,7 @@ describe Amalgalite::Database do
|
|
364
364
|
end
|
365
365
|
|
366
366
|
rudeness = Thread.new( @iso_db ) do |db|
|
367
|
-
|
367
|
+
control_queue.deq
|
368
368
|
count = 0
|
369
369
|
loop do
|
370
370
|
@iso_db.interrupt!
|
@@ -410,13 +410,12 @@ describe Amalgalite::Database do
|
|
410
410
|
end
|
411
411
|
|
412
412
|
it "rolls back a savepoint" do
|
413
|
-
all_sub = @iso_db.execute("SELECT count(*) as cnt from subcountry").first['cnt']
|
414
413
|
us_sub = @iso_db.execute("SELECT count(*) as cnt from subcountry where country = 'US'").first['cnt']
|
415
414
|
lambda {
|
416
415
|
@iso_db.savepoint( "t1" ) do |s|
|
417
416
|
s.execute("DELETE FROM subcountry where country = 'US'")
|
418
417
|
as = @iso_db.execute("SELECT count(*) as cnt from subcountry where country = 'US'").first['cnt']
|
419
|
-
as.should == 0
|
418
|
+
as.should be == 0
|
420
419
|
raise "sample error"
|
421
420
|
end
|
422
421
|
}.should raise_error( StandardError, /sample error/ )
|
@@ -494,7 +493,7 @@ describe Amalgalite::Database do
|
|
494
493
|
@iso_db.replicate_to( fdb )
|
495
494
|
@iso_db.close
|
496
495
|
|
497
|
-
File.exist?( SpecInfo.test_db ).should == true
|
496
|
+
File.exist?( SpecInfo.test_db ).should be == true
|
498
497
|
fdb.execute("SELECT count(*) as cnt from subcountry").first['cnt'].should == all_sub
|
499
498
|
end
|
500
499
|
|
@@ -502,4 +501,10 @@ describe Amalgalite::Database do
|
|
502
501
|
lambda { @iso_db.replicate_to( false ) }.should raise_error( ArgumentError, /must be a String or a Database/ )
|
503
502
|
end
|
504
503
|
|
504
|
+
it "imports batch statements" do
|
505
|
+
db = Amalgalite::Database.new(":memory:")
|
506
|
+
db.import("CREATE TABLE things(stuff TEXT); INSERT INTO things (stuff) VALUES (\"foobar\");").should be_true
|
507
|
+
db.first_value_from("SELECT stuff FROM things").should == "foobar"
|
508
|
+
end
|
509
|
+
|
505
510
|
end
|
data/spec/default_map_spec.rb
CHANGED
data/spec/function_spec.rb
CHANGED
data/spec/integeration_spec.rb
CHANGED
data/spec/packer_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
|
2
3
|
require 'amalgalite/packer'
|
3
|
-
require 'gemspec'
|
4
4
|
|
5
5
|
describe "Amalgalite::Packer" do
|
6
6
|
before( :each ) do
|
@@ -51,8 +51,8 @@ describe "Amalgalite::Packer" do
|
|
51
51
|
|
52
52
|
it "has all the lib files in the amalgalite gem" do
|
53
53
|
ro = Amalgalite::Packer.amalgalite_require_order
|
54
|
-
glist =
|
55
|
-
glist.map! { |l| l.sub("lib/","") }
|
54
|
+
glist = IO.readlines("Manifest.txt").select { |l| l.index("lib/amalgalite") == 0 }
|
55
|
+
glist.map! { |l| l.strip.sub("lib/","") }
|
56
56
|
(glist - ro).each do |l|
|
57
57
|
l.should_not =~ /amalgalite/
|
58
58
|
end
|
data/spec/paths_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
class PH < ::Amalgalite::ProgressHandler
|
4
4
|
attr_reader :call_count
|
@@ -16,12 +16,11 @@ class PH < ::Amalgalite::ProgressHandler
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def query_thread(
|
20
|
-
Thread.new(
|
19
|
+
def query_thread( database )
|
20
|
+
Thread.new( database ) do |db|
|
21
21
|
begin
|
22
22
|
db.execute("select count(id) from country")
|
23
23
|
rescue => e
|
24
|
-
had_error = e
|
25
24
|
Thread.current[:exception] = e
|
26
25
|
end
|
27
26
|
end
|
@@ -69,7 +68,7 @@ describe "Progress Handlers" do
|
|
69
68
|
qt.join
|
70
69
|
ph.call_count.should eql(25)
|
71
70
|
qt[:exception].should be_instance_of( ::Amalgalite::SQLite3::Error )
|
72
|
-
@iso_db.api.last_error_code.should == 9
|
71
|
+
@iso_db.api.last_error_code.should be == 9
|
73
72
|
@iso_db.api.last_error_message.should =~ /interrupted/
|
74
73
|
qt[:exception].message.should =~ /interrupted/
|
75
74
|
end
|
data/spec/requires_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'amalgalite/requires'
|
3
3
|
|
4
4
|
#describe Amalgalite::Requires do
|
5
5
|
# it "#require_order has all files in 'lib' and no more" do
|
@@ -18,3 +18,37 @@ $: << File.expand_path(File.join(File.dirname(__FILE__),"..","lib"))
|
|
18
18
|
#end
|
19
19
|
|
20
20
|
|
21
|
+
describe Amalgalite::Requires do
|
22
|
+
it "can import to an in-memory database" do
|
23
|
+
sql = <<-SQL
|
24
|
+
CREATE TABLE rubylibs (
|
25
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
26
|
+
filename TEXT UNIQUE,
|
27
|
+
compressed BOOLEAN,
|
28
|
+
contents BLOB
|
29
|
+
);
|
30
|
+
INSERT INTO "rubylibs" VALUES(1, "application", "false", 'A=1');
|
31
|
+
SQL
|
32
|
+
r = Amalgalite::Requires.new(:dbfile_name => ":memory:")
|
33
|
+
r.import(sql)
|
34
|
+
r.file_contents( "application" ).should == "A=1"
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
it "gives equal instances for file databases" do
|
39
|
+
a = Amalgalite::Requires.new( :dbfile_name => SpecInfo.test_db )
|
40
|
+
b = Amalgalite::Requires.new( :dbfile_name => SpecInfo.test_db )
|
41
|
+
|
42
|
+
a.db_connection.should equal( b.db_connection )
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
it "gives separate instances for in-memory databases" do
|
47
|
+
a = Amalgalite::Requires.new( :dbfile_name => ":memory:" )
|
48
|
+
b = Amalgalite::Requires.new( :dbfile_name => ":memory:" )
|
49
|
+
|
50
|
+
a.db_connection.should_not equal(b.db_connection)
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
end
|
data/spec/rtree_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
|
2
3
|
#
|
3
4
|
# Example from http://sqlite.org/rtree.html
|
4
5
|
#
|
@@ -37,9 +38,9 @@ describe "SQLite3 R*Tree extension" do
|
|
37
38
|
|
38
39
|
it "queries normally" do
|
39
40
|
r = @db.execute "SELECT * FROM demo_index WHERE id=1;"
|
40
|
-
r.size.should == 1
|
41
|
+
r.size.should be == 1
|
41
42
|
row = r.first
|
42
|
-
row['id'].should == 1
|
43
|
+
row['id'].should be == 1
|
43
44
|
end
|
44
45
|
|
45
46
|
it "does a 'contained within' query" do
|
@@ -49,8 +50,8 @@ describe "SQLite3 R*Tree extension" do
|
|
49
50
|
AND minY>=30.00 AND maxY<=30.44;
|
50
51
|
sql
|
51
52
|
|
52
|
-
r.size.should == 1
|
53
|
-
r.first['id'].should == 1
|
53
|
+
r.size.should be == 1
|
54
|
+
r.first['id'].should be == 1
|
54
55
|
end
|
55
56
|
|
56
57
|
it "does an 'overlapping' query" do
|
data/spec/schema_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
require 'amalgalite'
|
4
4
|
require 'amalgalite/schema'
|
@@ -15,7 +15,7 @@ describe Amalgalite::Schema do
|
|
15
15
|
s = @iso_db.schema
|
16
16
|
sql = "CREATE VIEW v1 AS SELECT c.name, c.two_letter, s.name, s.subdivision FROM country AS c JOIN subcountry AS s ON c.two_letter = s.country"
|
17
17
|
@iso_db.execute( sql )
|
18
|
-
s.dirty?.should == true
|
18
|
+
s.dirty?.should be == true
|
19
19
|
@iso_db.schema.load_views
|
20
20
|
@iso_db.schema.views.size.should eql(1)
|
21
21
|
@iso_db.schema.views["v1"].sql.should eql(sql)
|
@@ -25,9 +25,9 @@ describe Amalgalite::Schema do
|
|
25
25
|
s = @iso_db.schema
|
26
26
|
sql = "CREATE TABLE t1( d1 default 't' )"
|
27
27
|
@iso_db.execute( sql )
|
28
|
-
s.dirty?.should == true
|
28
|
+
s.dirty?.should be == true
|
29
29
|
tt = @iso_db.schema.tables['t1']
|
30
|
-
tt.columns['d1'].default_value.should == "t"
|
30
|
+
tt.columns['d1'].default_value.should be == "t"
|
31
31
|
end
|
32
32
|
|
33
33
|
it "loads the tables and columns" do
|
@@ -56,23 +56,22 @@ describe Amalgalite::Schema do
|
|
56
56
|
s = @iso_db.schema
|
57
57
|
sql = "CREATE TABLE u( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , other text )"
|
58
58
|
@iso_db.execute( sql )
|
59
|
-
s.dirty?.should == true
|
59
|
+
s.dirty?.should be == true
|
60
60
|
ut = @iso_db.schema.tables['u']
|
61
61
|
ut.primary_key.should == [ ut.columns['id'] ]
|
62
62
|
end
|
63
63
|
|
64
64
|
it "knows the primary key of a temporary table" do
|
65
65
|
@iso_db.execute "CREATE TEMPORARY TABLE tt( a, b INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, c )"
|
66
|
-
tt = @iso_db.schema.
|
66
|
+
tt = @iso_db.schema.tables[ 'tt' ]
|
67
67
|
tt.primary_key.should == [ tt.columns['b'] ]
|
68
|
-
|
69
68
|
end
|
70
69
|
|
71
70
|
it "knows what the primary key of a table is when it is a multiple column primary key" do
|
72
71
|
sql = "CREATE TABLE m ( id1, id2, PRIMARY KEY (id2, id1) )"
|
73
72
|
s = @iso_db.schema
|
74
73
|
@iso_db.execute( sql )
|
75
|
-
s.dirty?.should == true
|
74
|
+
s.dirty?.should be == true
|
76
75
|
mt = @iso_db.schema.tables['m']
|
77
76
|
mt.primary_key.should == [ mt.columns['id2'], mt.columns['id1'] ]
|
78
77
|
end
|
@@ -93,31 +92,40 @@ describe Amalgalite::Schema do
|
|
93
92
|
|
94
93
|
it "knows the schema is dirty when a table is created" do
|
95
94
|
s = @iso_db.schema
|
96
|
-
|
97
|
-
s.dirty?.should == false
|
95
|
+
s.tables['country']
|
96
|
+
s.dirty?.should be == false
|
98
97
|
@iso_db.execute( "create table x1( a, b )" )
|
99
|
-
s.dirty?.should == true
|
98
|
+
s.dirty?.should be == true
|
100
99
|
end
|
101
100
|
|
102
101
|
it "knows the schema is dirty when a table is dropped" do
|
103
102
|
s = @iso_db.schema
|
104
|
-
|
103
|
+
s.tables['country']
|
105
104
|
@iso_db.execute( "create table x1( a, b )" )
|
106
|
-
s.dirty?.should == true
|
105
|
+
s.dirty?.should be == true
|
107
106
|
|
108
107
|
@iso_db.schema.load_schema!
|
109
108
|
s = @iso_db.schema
|
110
109
|
|
111
|
-
s.dirty?.should == false
|
110
|
+
s.dirty?.should be == false
|
112
111
|
@iso_db.execute("drop table x1")
|
113
|
-
s.dirty?.should == true
|
112
|
+
s.dirty?.should be == true
|
114
113
|
end
|
115
114
|
|
115
|
+
it "knows if a temporary table exists" do
|
116
|
+
@iso_db.execute "CREATE TEMPORARY TABLE tt(a,b,c)"
|
117
|
+
@iso_db.schema.tables.keys.include?('tt').should be == true
|
118
|
+
@iso_db.schema.tables['tt'].temporary?.should be == true
|
119
|
+
end
|
116
120
|
|
117
|
-
it "
|
118
|
-
@iso_db.execute "CREATE
|
119
|
-
@iso_db.schema.tables['tt'].should
|
120
|
-
@iso_db.
|
121
|
-
@iso_db.schema.tables['tt'].should
|
121
|
+
it "sees that temporary tables shadow real tables" do
|
122
|
+
@iso_db.execute "CREATE TABLE tt(x)"
|
123
|
+
@iso_db.schema.tables['tt'].temporary?.should be == false
|
124
|
+
@iso_db.execute "CREATE TEMP TABLE tt(a,b,c)"
|
125
|
+
@iso_db.schema.tables['tt'].temporary?.should be == true
|
126
|
+
@iso_db.execute "DROP TABLE tt"
|
127
|
+
@iso_db.schema.tables['tt'].temporary?.should be == false
|
128
|
+
@iso_db.schema.tables['tt'].columns.size.should be == 1
|
122
129
|
end
|
130
|
+
|
123
131
|
end
|