Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sqlite3
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
node-sqlite3
Commits
eb4e5a30
Commit
eb4e5a30
authored
Feb 12, 2012
by
Nathan Rajlich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax highlighting in the README.
parent
812c5d39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
README.md
README.md
+20
-18
No files found.
README.md
View file @
eb4e5a30
...
...
@@ -8,24 +8,26 @@ node-sqlite3 - Asynchronous, non-blocking [SQLite3](http://sqlite.org/) bindings
Install with
`npm install sqlite3`
.
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');
db.serialize(function() {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();
db.each("SELECT rowid AS id, info FROM lorem", function(err, row) {
console.log(row.id + ": " + row.info);
});
});
db.close();
```
js
var
sqlite3
=
require
(
'sqlite3'
).
verbose
();
var
db
=
new
sqlite3
.
Database
(
':memory:'
);
db
.
serialize
(
function
()
{
db
.
run
(
"CREATE TABLE lorem (info TEXT)"
);
var
stmt
=
db
.
prepare
(
"INSERT INTO lorem VALUES (?)"
);
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
stmt
.
run
(
"Ipsum "
+
i
);
}
stmt
.
finalize
();
db
.
each
(
"SELECT rowid AS id, info FROM lorem"
,
function
(
err
,
row
)
{
console
.
log
(
row
.
id
+
": "
+
row
.
info
);
});
});
db
.
close
();
```
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment