YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -0,0 +1,27 @@
--
-- demo\rosetta\Parametrized_SQL_statement.exw
--
include pSQLite.e
sqlite3 db = sqlite3_open(":memory:")
integer res = sqlite3_exec(db,`create table players (name, score, active, jerseyNum)`)
res = sqlite3_exec(db,`insert into players values ('Roethlisberger, Ben', 94.1, 1, 7 )`)
res = sqlite3_exec(db,`insert into players values ('Smith, Alex', 85.3, 1, 11)`)
res = sqlite3_exec(db,`insert into players values ('Doe, John', 15, 0, 99)`)
res = sqlite3_exec(db,`insert into players values ('Manning, Payton', 96.5, 0, 123)`)
pp({"Before",sqlite3_get_table(db, "select * from players")},{pp_Nest,2})
sqlite3_stmt pStmt = sqlite3_prepare(db, `update players set name=?, score=?, active=? where jerseyNum=?`)
sqlite3_bind_text(pStmt,1,"Smith, Steve")
sqlite3_bind_double(pStmt,2,42)
sqlite3_bind_int(pStmt,3,true)
sqlite3_bind_int(pStmt,4,99)
res = sqlite3_step(pStmt);
if res!=SQLITE_DONE then ?9/0 end if
if sqlite3_finalize(pStmt)!=SQLITE_OK then ?9/0 end if
pp({"After",sqlite3_get_table(db, "select * from players")},{pp_Nest,2})
sqlite3_close(db)