diff --git a/README.md b/README.md index cf26a04..2ba4a42 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ dependencies: require "sqlite3" DB.open "sqlite3://./data.db" do |db| - db.exec "create table contacts (name string, age integer)" + db.exec "create table contacts (name text, age integer)" db.exec "insert into contacts values (?, ?)", "John Doe", 30 args = [] of DB::Any diff --git a/samples/memory.cr b/samples/memory.cr index c68cd08..87e02cc 100644 --- a/samples/memory.cr +++ b/samples/memory.cr @@ -2,7 +2,7 @@ require "db" require "../src/sqlite3" DB.open "sqlite3://%3Amemory%3A" do |db| - db.exec "create table contacts (name string, age integer)" + db.exec "create table contacts (name text, age integer)" db.exec "insert into contacts values (?, ?)", "John Doe", 30 args = [] of DB::Any diff --git a/spec/connection_spec.cr b/spec/connection_spec.cr index bc28dc8..be3bf0c 100644 --- a/spec/connection_spec.cr +++ b/spec/connection_spec.cr @@ -14,7 +14,7 @@ describe Connection do it "opens a database and then backs it up to another db" do with_db do |db| with_db("./test2.db") do |backup_db| - db.exec "create table person (name string, age integer)" + db.exec "create table person (name text, age integer)" db.exec "insert into person values (\"foo\", 10)" dump db, backup_db @@ -32,7 +32,7 @@ describe Connection do it "opens a database, inserts records, dumps to an in-memory db, insers some more, then dumps to the source" do with_db do |db| with_mem_db do |in_memory_db| - db.exec "create table person (name string, age integer)" + db.exec "create table person (name text, age integer)" db.exec "insert into person values (\"foo\", 10)" dump db, in_memory_db @@ -48,7 +48,7 @@ describe Connection do it "opens a database, inserts records (>1024K), and dumps to an in-memory db" do with_db do |db| with_mem_db do |in_memory_db| - db.exec "create table person (name string, age integer)" + db.exec "create table person (name text, age integer)" db.transaction do |tx| 100_000.times { tx.connection.exec "insert into person values (\"foo\", 10)" } end @@ -62,7 +62,7 @@ describe Connection do with_cnn do |cnn| cnn.should be_a(SQLite3::Connection) - cnn.exec "create table person (name string, age integer)" + cnn.exec "create table person (name text, age integer)" cnn.exec "insert into person values (\"foo\", 10)" cnn.scalar("select count(*) from person").should eq(1) diff --git a/spec/db_spec.cr b/spec/db_spec.cr index ff508f6..d8c0b01 100644 --- a/spec/db_spec.cr +++ b/spec/db_spec.cr @@ -80,7 +80,7 @@ DB::DriverSpecs(DB::Any).run do end it "gets last insert row id", prepared: :both do |db| - db.exec "create table person (name string, age integer)" + db.exec "create table person (name text, age integer)" db.exec %(insert into person values ("foo", 10)) res = db.exec %(insert into person values ("foo", 10)) res.last_insert_id.should eq(2)