2 single: SQLite; Introduction
8 In this chapter we will learn about using the SQLite database in the Ring programming language.
10 Before using the next function load the sqlitelib.ring library
15 # Use SQLite functions
18 pair: SQLite; sqlite_init()
20 sqlite_init() function
21 ======================
27 sqlite_init() ---> SQLite Object
30 pair: SQLite; sqlite_open()
32 sqlite_open() function
33 ======================
39 sqlite_open(SQLite Object,cFileName)
42 pair: SQLite; sqlite_execute()
44 sqlite_execute() function
45 =========================
51 sqlite_execute(SQLite Object,cSQLStatement)
54 pair: SQLite; sqlite_close()
56 sqlite_close() function
57 =======================
63 sqlite_close(SQLite Object)
68 The next code create a SQLite database, add new records then display the data.
74 oSQLite = sqlite_init()
76 sqlite_open(oSQLite,"mytest.db")
79 CREATE TABLE COMPANY (
80 ID INT PRIMARY KEY NOT NULL,
86 sqlite_execute(oSQLite,sql)
89 INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
90 VALUES (1, 'Mahmoud' , 29, 'Jeddah', 20000.00 ),
91 (2, 'Ahmed' , 27, 'Jeddah', 15000.00 ),
92 (3, 'Mohammed', 31, 'Egypt' , 20000.00 ),
93 (4, 'Ibrahim' , 24, 'Egypt ', 65000.00 );
96 sqlite_execute(oSQLite,sql)
98 aResult = sqlite_execute(oSQLite,"select * from COMPANY")
108 sqlite_close(oSQLite)
134 **************************************************