From 3b5217d73b65be57be050dbfcc60fa59fc44ac28 Mon Sep 17 00:00:00 2001 From: Eliska Hutnikova Date: Fri, 22 Jan 2016 20:09:38 +0100 Subject: [PATCH] Added table creation that is necessary to run example in synopsis Fixed comment that describes creating a table --- README.rdoc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.rdoc b/README.rdoc index 12e78df3..ace9dc5d 100644 --- a/README.rdoc +++ b/README.rdoc @@ -20,7 +20,7 @@ Note that this module is only compatible with SQLite 3.6.16 or newer. # Open a database db = SQLite3::Database.new "test.db" - # Create a database + # Create a table rows = db.execute <<-SQL create table numbers ( name varchar(30), @@ -36,9 +36,20 @@ Note that this module is only compatible with SQLite 3.6.16 or newer. db.execute "insert into numbers values ( ?, ? )", pair end + # Create another table with multiple columns + + db.execute <<-SQL + create table students ( + name varchar(50), + email varchar(50), + grade varchar(5), + blog varchar(50) + ); + SQL + # Execute inserts with parameter markers db.execute("INSERT INTO students (name, email, grade, blog) - VALUES (?, ?, ?, ?)", [@name, @email, @grade, @blog]) + VALUES (?, ?, ?, ?)", ["Jane", "me@janedoe.com", "A", "http://blog.janedoe.com"]) # Find a few rows db.execute( "select * from numbers" ) do |row|