Skip to content

Commit 637e392

Browse files
committed
Merge pull request #177 from eliskah/synopsis
Added table creation that is necessary to run example in synopsis
2 parents 7dc8122 + 3b5217d commit 637e392

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.rdoc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Note that this module is only compatible with SQLite 3.6.16 or newer.
2020
# Open a database
2121
db = SQLite3::Database.new "test.db"
2222

23-
# Create a database
23+
# Create a table
2424
rows = db.execute <<-SQL
2525
create table numbers (
2626
name varchar(30),
@@ -36,9 +36,20 @@ Note that this module is only compatible with SQLite 3.6.16 or newer.
3636
db.execute "insert into numbers values ( ?, ? )", pair
3737
end
3838

39+
# Create another table with multiple columns
40+
41+
db.execute <<-SQL
42+
create table students (
43+
name varchar(50),
44+
email varchar(50),
45+
grade varchar(5),
46+
blog varchar(50)
47+
);
48+
SQL
49+
3950
# Execute inserts with parameter markers
4051
db.execute("INSERT INTO students (name, email, grade, blog)
41-
VALUES (?, ?, ?, ?)", [@name, @email, @grade, @blog])
52+
VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"])
4253

4354
# Find a few rows
4455
db.execute( "select * from numbers" ) do |row|

0 commit comments

Comments
 (0)