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
6a3aa878
Commit
6a3aa878
authored
Feb 18, 2011
by
Konstantin Käfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure that we're only calling functions
parent
0668424b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
database.cc
src/database.cc
+4
-4
statement.cc
src/statement.cc
+7
-5
No files found.
src/database.cc
View file @
6a3aa878
...
...
@@ -53,7 +53,7 @@ void Database::Process() {
// Call all callbacks with the error object.
while
(
!
queue
.
empty
())
{
Call
*
call
=
queue
.
front
();
if
(
!
call
->
baton
->
callback
.
IsEmpty
())
{
if
(
!
call
->
baton
->
callback
.
IsEmpty
()
&&
call
->
baton
->
callback
->
IsFunction
()
)
{
TRY_CATCH_CALL
(
handle_
,
call
->
baton
->
callback
,
1
,
argv
);
called
=
true
;
}
...
...
@@ -89,7 +89,7 @@ void Database::Process() {
void
Database
::
Schedule
(
EIO_Callback
callback
,
Baton
*
baton
,
bool
exclusive
=
false
)
{
if
(
!
open
&&
locked
)
{
EXCEPTION
(
String
::
New
(
"Database is closed"
),
SQLITE_MISUSE
,
exception
);
if
(
!
baton
->
callback
.
IsEmpty
())
{
if
(
!
baton
->
callback
.
IsEmpty
()
&&
baton
->
callback
->
IsFunction
()
)
{
Local
<
Value
>
argv
[]
=
{
exception
};
TRY_CATCH_CALL
(
handle_
,
baton
->
callback
,
1
,
argv
);
}
...
...
@@ -183,7 +183,7 @@ int Database::EIO_AfterOpen(eio_req *req) {
argv
[
0
]
=
Local
<
Value
>::
New
(
Null
());
}
if
(
!
baton
->
callback
.
IsEmpty
())
{
if
(
!
baton
->
callback
.
IsEmpty
()
&&
baton
->
callback
->
IsFunction
()
)
{
TRY_CATCH_CALL
(
db
->
handle_
,
baton
->
callback
,
1
,
argv
);
}
else
if
(
!
db
->
open
)
{
...
...
@@ -253,7 +253,7 @@ int Database::EIO_AfterClose(eio_req *req) {
}
// Fire callbacks.
if
(
!
baton
->
callback
.
IsEmpty
())
{
if
(
!
baton
->
callback
.
IsEmpty
()
&&
baton
->
callback
->
IsFunction
()
)
{
TRY_CATCH_CALL
(
db
->
handle_
,
baton
->
callback
,
1
,
argv
);
}
else
if
(
db
->
open
)
{
...
...
src/statement.cc
View file @
6a3aa878
...
...
@@ -173,11 +173,13 @@ int Statement::EIO_AfterPrepare(eio_req *req) {
argv
[
0
]
=
Local
<
Value
>::
New
(
Null
());
}
fprintf
(
stderr
,
"after prepare
\n
"
);
// Fire callbacks.
if
(
!
baton
->
callback
.
IsEmpty
())
{
if
(
!
baton
->
callback
.
IsEmpty
()
&&
baton
->
callback
->
IsFunction
()
)
{
TRY_CATCH_CALL
(
stmt
->
handle_
,
baton
->
callback
,
1
,
argv
);
}
else
{
else
if
(
!
stmt
->
prepared
)
{
Local
<
Value
>
args
[]
=
{
String
::
NewSymbol
(
"error"
),
argv
[
0
]
};
EMIT_EVENT
(
stmt
->
handle_
,
2
,
args
);
}
...
...
@@ -191,7 +193,6 @@ int Statement::EIO_AfterPrepare(eio_req *req) {
stmt
->
Finalize
();
}
delete
baton
;
return
0
;
}
...
...
@@ -213,7 +214,7 @@ void Statement::Finalize(Baton* baton) {
baton
->
stmt
->
Finalize
();
// Fire callback in case there was one.
if
(
!
baton
->
callback
.
IsEmpty
())
{
if
(
!
baton
->
callback
.
IsEmpty
()
&&
baton
->
callback
->
IsFunction
()
)
{
TRY_CATCH_CALL
(
baton
->
stmt
->
handle_
,
baton
->
callback
,
0
,
NULL
);
}
...
...
@@ -247,7 +248,8 @@ void Statement::CleanQueue() {
Call
*
call
=
queue
.
front
();
queue
.
pop
();
if
(
prepared
&&
!
call
->
baton
->
callback
.
IsEmpty
())
{
if
(
prepared
&&
!
call
->
baton
->
callback
.
IsEmpty
()
&&
call
->
baton
->
callback
->
IsFunction
())
{
TRY_CATCH_CALL
(
handle_
,
call
->
baton
->
callback
,
1
,
argv
);
called
=
true
;
}
...
...
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