mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 23:23:07 +00:00 
			
		
		
		
	Update readme.md
This commit is contained in:
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @@ -158,21 +158,21 @@ make natives | ||||
| Next, enter the repl and create a database and a table. | ||||
|  | ||||
| ``` | ||||
| janet:1:> (import natives.sqlite3 :as sql) | ||||
| janet:1:> (import natives/sqlite3 :as sql) | ||||
| nil | ||||
| janet:2:> (def db (sql.open "test.db")) | ||||
| janet:2:> (def db (sql/open "test.db")) | ||||
| <sqlite3.connection 0x5561A138C470> | ||||
| janet:3:> (sql.eval db `CREATE TABLE customers(id INTEGER PRIMARY KEY, name TEXT);`) | ||||
| janet:3:> (sql/eval db `CREATE TABLE customers(id INTEGER PRIMARY KEY, name TEXT);`) | ||||
| @[] | ||||
| janet:4:> (sql.eval db `INSERT INTO customers VALUES(:id, :name);` {:name "John" :id 12345}) | ||||
| janet:4:> (sql/eval db `INSERT INTO customers VALUES(:id, :name);` {:name "John" :id 12345}) | ||||
| @[] | ||||
| janet:5:> (sql.eval db `SELECT * FROM customers;`) | ||||
| janet:5:> (sql/eval db `SELECT * FROM customers;`) | ||||
| @[{"id" 12345 "name" "John"}] | ||||
| ``` | ||||
|  | ||||
| Finally, close the database connection when done with it. | ||||
|  | ||||
| ``` | ||||
| janet:6:> (sql.close db) | ||||
| janet:6:> (sql/close db) | ||||
| nil | ||||
| ``` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose