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
a3401c87
Commit
a3401c87
authored
Dec 11, 2009
by
Eric Fredricksen
Committed by
Eric Fredricksen
Dec 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deal with node exiting race bug, clean some stuff.
parent
ef34faff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
compiloop.py
compiloop.py
+1
-1
sqlite3_bindings.cc
sqlite3_bindings.cc
+13
-13
test.js
test.js
+6
-0
No files found.
compiloop.py
View file @
a3401c87
...
@@ -9,7 +9,7 @@ filenames = ["sqlite3_bindings.cc", "wscript", "sqlite.js", "test.js"]
...
@@ -9,7 +9,7 @@ filenames = ["sqlite3_bindings.cc", "wscript", "sqlite.js", "test.js"]
def
handler
():
def
handler
():
os
.
system
(
"clear; rm -f test.db"
)
os
.
system
(
"clear; rm -f test.db"
)
os
.
system
(
"node-waf build && node test.js && sqlite3 test.db .dump"
);
os
.
system
(
"node-waf build && node test.js && s
leep 1 && s
qlite3 test.db .dump"
);
mtime
=
[]
mtime
=
[]
while
True
:
while
True
:
...
...
sqlite3_bindings.cc
View file @
a3401c87
...
@@ -87,15 +87,18 @@ protected:
...
@@ -87,15 +87,18 @@ protected:
String
::
Utf8Value
usql
(
args
[
0
]
->
ToString
());
String
::
Utf8Value
usql
(
args
[
0
]
->
ToString
());
const
char
*
sql
(
*
usql
);
const
char
*
sql
(
*
usql
);
int
changes
=
0
;
int
param
=
0
;
int
param
=
0
;
Local
<
Array
>
result
(
Array
::
New
(
0
));
Local
<
Array
>
all
(
Array
::
New
(
0
));
for
(;;)
{
for
(;;)
{
sqlite3_stmt
*
stmt
;
sqlite3_stmt
*
stmt
;
int
rc
=
sqlite3_prepare_v2
(
*
db
,
sql
,
-
1
,
&
stmt
,
&
sql
);
int
rc
=
sqlite3_prepare_v2
(
*
db
,
sql
,
-
1
,
&
stmt
,
&
sql
);
if
(
rc
!=
SQLITE_OK
)
{
return
ThrowException
(
Exception
::
Error
(
String
::
New
(
sqlite3_errmsg
(
*
db
))));
}
if
(
!
stmt
)
break
;
if
(
!
stmt
)
break
;
Statement
statement
(
stmt
);
Statement
statement
(
stmt
);
...
@@ -122,7 +125,7 @@ protected:
...
@@ -122,7 +125,7 @@ protected:
}
}
}
}
Local
<
Array
>
ro
sult
(
Array
::
New
(
0
));
Local
<
Array
>
ro
ws
(
Array
::
New
(
0
));
for
(
int
r
=
0
;
;
++
r
)
{
for
(
int
r
=
0
;
;
++
r
)
{
int
rc
=
sqlite3_step
(
statement
);
int
rc
=
sqlite3_step
(
statement
);
...
@@ -148,7 +151,7 @@ protected:
...
@@ -148,7 +151,7 @@ protected:
row
->
Set
(
String
::
NewSymbol
(
sqlite3_column_name
(
statement
,
c
)),
row
->
Set
(
String
::
NewSymbol
(
sqlite3_column_name
(
statement
,
c
)),
value
);
value
);
}
}
ro
sult
->
Set
(
Integer
::
New
(
rosult
->
Length
()),
row
);
ro
ws
->
Set
(
Integer
::
New
(
rows
->
Length
()),
row
);
}
else
if
(
rc
==
SQLITE_DONE
)
{
}
else
if
(
rc
==
SQLITE_DONE
)
{
break
;
break
;
}
else
{
}
else
{
...
@@ -157,20 +160,17 @@ protected:
...
@@ -157,20 +160,17 @@ protected:
}
}
}
}
changes
+=
sqlite3_changes
(
*
db
);
rows
->
Set
(
String
::
New
(
"rowsAffected"
),
Integer
::
New
(
sqlite3_changes
(
*
db
)));
rows
->
Set
(
String
::
New
(
"insertId"
),
Integer
::
New
(
sqlite3_last_insert_rowid
(
*
db
)));
rosult
->
Set
(
String
::
New
(
"rowsAffected"
),
Integer
::
New
(
sqlite3_changes
(
*
db
)));
all
->
Set
(
Integer
::
New
(
all
->
Length
()),
rows
);
rosult
->
Set
(
String
::
New
(
"insertId"
),
Integer
::
New
(
sqlite3_last_insert_rowid
(
*
db
)));
result
->
Set
(
Integer
::
New
(
result
->
Length
()),
rosult
);
sqlite3_finalize
(
stmt
);
sqlite3_finalize
(
stmt
);
}
}
result
->
Set
(
String
::
New
(
"rowsAffected"
),
Integer
::
New
(
changes
));
return
all
;
result
->
Set
(
String
::
New
(
"insertId"
),
Integer
::
New
(
sqlite3_last_insert_rowid
(
*
db
)));
return
result
;
}
}
...
...
test.js
View file @
a3401c87
...
@@ -82,6 +82,12 @@ db.transaction(function(tx) {
...
@@ -82,6 +82,12 @@ db.transaction(function(tx) {
var
na
=
db
.
query
(
""
);
var
na
=
db
.
query
(
""
);
asserteq
(
na
,
null
);
asserteq
(
na
,
null
);
try
{
na
=
db
.
query
(
"CRAPPY QUERY THAT DOESN'T WORK"
);
asserteq
(
"Apples"
,
"Oranges"
);
}
catch
(
e
)
{
}
db
.
close
();
db
.
close
();
sys
.
puts
(
"OK
\
n"
);
sys
.
puts
(
"OK
\
n"
);
...
...
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