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
3ff58b6e
Commit
3ff58b6e
authored
Mar 24, 2010
by
Orlando Vazquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unref before callbacks are fired, and Statements should only Ref() on New and Unref() on Finalize
parent
ec1fb7e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
17 deletions
+16
-17
speedtest-low-parallel.js
speedtest-low-parallel.js
+2
-0
sqlite3_bindings.cc
sqlite3_bindings.cc
+14
-17
No files found.
speedtest-low-parallel.js
View file @
3ff58b6e
...
@@ -12,7 +12,9 @@ var t0;
...
@@ -12,7 +12,9 @@ var t0;
var
statement
;
var
statement
;
function
onStep
(
error
,
row
)
{
function
onStep
(
error
,
row
)
{
// puts(inspect(arguments));
var
d
;
var
d
;
if
(
error
)
throw
error
;
if
(
!
row
)
{
if
(
!
row
)
{
statement
.
finalize
(
function
()
{
puts
(
"finalized"
)
});
statement
.
finalize
(
function
()
{
puts
(
"finalized"
)
});
d
=
((
new
Date
)
-
t0
)
/
1000
;
d
=
((
new
Date
)
-
t0
)
/
1000
;
...
...
sqlite3_bindings.cc
View file @
3ff58b6e
...
@@ -145,6 +145,7 @@ protected:
...
@@ -145,6 +145,7 @@ protected:
TryCatch
try_catch
;
TryCatch
try_catch
;
open_req
->
dbo
->
Unref
();
open_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
err
?
1
:
0
,
argv
);
open_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
err
?
1
:
0
,
argv
);
if
(
try_catch
.
HasCaught
())
{
if
(
try_catch
.
HasCaught
())
{
...
@@ -154,7 +155,6 @@ protected:
...
@@ -154,7 +155,6 @@ protected:
open_req
->
dbo
->
Emit
(
String
::
New
(
"ready"
),
0
,
NULL
);
open_req
->
dbo
->
Emit
(
String
::
New
(
"ready"
),
0
,
NULL
);
open_req
->
cb
.
Dispose
();
open_req
->
cb
.
Dispose
();
open_req
->
dbo
->
Unref
();
free
(
open_req
);
free
(
open_req
);
return
0
;
return
0
;
...
@@ -243,6 +243,7 @@ protected:
...
@@ -243,6 +243,7 @@ protected:
TryCatch
try_catch
;
TryCatch
try_catch
;
close_req
->
dbo
->
Unref
();
close_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
err
?
1
:
0
,
argv
);
close_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
err
?
1
:
0
,
argv
);
if
(
try_catch
.
HasCaught
())
{
if
(
try_catch
.
HasCaught
())
{
...
@@ -251,7 +252,6 @@ protected:
...
@@ -251,7 +252,6 @@ protected:
close_req
->
cb
.
Dispose
();
close_req
->
cb
.
Dispose
();
close_req
->
dbo
->
Unref
();
free
(
close_req
);
free
(
close_req
);
return
0
;
return
0
;
...
@@ -367,13 +367,13 @@ protected:
...
@@ -367,13 +367,13 @@ protected:
TryCatch
try_catch
;
TryCatch
try_catch
;
prep_req
->
dbo
->
Unref
();
prep_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
argc
,
argv
);
prep_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
argc
,
argv
);
if
(
try_catch
.
HasCaught
())
{
if
(
try_catch
.
HasCaught
())
{
FatalException
(
try_catch
);
FatalException
(
try_catch
);
}
}
prep_req
->
dbo
->
Unref
();
prep_req
->
cb
.
Dispose
();
prep_req
->
cb
.
Dispose
();
free
(
prep_req
);
free
(
prep_req
);
...
@@ -471,8 +471,9 @@ protected:
...
@@ -471,8 +471,9 @@ protected:
REQ_EXT_ARG
(
0
,
stmt
);
REQ_EXT_ARG
(
0
,
stmt
);
int
first_rc
=
args
[
1
]
->
IntegerValue
();
int
first_rc
=
args
[
1
]
->
IntegerValue
();
Statement
*
s
=
new
Statement
((
sqlite3_stmt
*
)
stmt
->
Value
(),
first_rc
);
Statement
*
sto
=
new
Statement
((
sqlite3_stmt
*
)
stmt
->
Value
(),
first_rc
);
s
->
Wrap
(
args
.
This
());
sto
->
Wrap
(
args
.
This
());
sto
->
Ref
();
return
args
.
This
();
return
args
.
This
();
}
}
...
@@ -546,7 +547,6 @@ protected:
...
@@ -546,7 +547,6 @@ protected:
}
}
bind_req
->
cb
.
Dispose
();
bind_req
->
cb
.
Dispose
();
sto
->
Unref
();
free
(
bind_req
->
key
);
free
(
bind_req
->
key
);
free
(
bind_req
->
value
);
free
(
bind_req
->
value
);
...
@@ -681,7 +681,6 @@ protected:
...
@@ -681,7 +681,6 @@ protected:
eio_custom
(
EIO_Bind
,
EIO_PRI_DEFAULT
,
EIO_AfterBind
,
bind_req
);
eio_custom
(
EIO_Bind
,
EIO_PRI_DEFAULT
,
EIO_AfterBind
,
bind_req
);
ev_ref
(
EV_DEFAULT_UC
);
ev_ref
(
EV_DEFAULT_UC
);
sto
->
Ref
();
return
Undefined
();
return
Undefined
();
}
}
...
@@ -716,6 +715,7 @@ protected:
...
@@ -716,6 +715,7 @@ protected:
argv
[
0
]
=
Local
<
Value
>::
New
(
Undefined
());
argv
[
0
]
=
Local
<
Value
>::
New
(
Undefined
());
finalize_req
->
sto
->
Unref
();
finalize_req
->
cb
->
Call
(
finalize_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
1
,
argv
);
Context
::
GetCurrent
()
->
Global
(),
1
,
argv
);
...
@@ -725,7 +725,6 @@ protected:
...
@@ -725,7 +725,6 @@ protected:
finalize_req
->
cb
.
Dispose
();
finalize_req
->
cb
.
Dispose
();
finalize_req
->
sto
->
Unref
();
free
(
finalize_req
);
free
(
finalize_req
);
return
0
;
return
0
;
...
@@ -772,12 +771,12 @@ protected:
...
@@ -772,12 +771,12 @@ protected:
return
Undefined
();
return
Undefined
();
}
}
static
Handle
<
Value
>
Reset
(
const
Arguments
&
args
)
{
//
static Handle<Value> Reset(const Arguments& args) {
HandleScope
scope
;
//
HandleScope scope;
Statement
*
stmt
=
ObjectWrap
::
Unwrap
<
Statement
>
(
args
.
This
());
//
Statement* stmt = ObjectWrap::Unwrap<Statement>(args.This());
SCHECK
(
sqlite3_reset
(
*
stmt
));
//
SCHECK(sqlite3_reset(*stmt));
return
Undefined
();
//
return Undefined();
}
//
}
struct
step_request
{
struct
step_request
{
Persistent
<
Function
>
cb
;
Persistent
<
Function
>
cb
;
...
@@ -829,13 +828,11 @@ protected:
...
@@ -829,13 +828,11 @@ protected:
case
SQLITE_INTEGER
:
case
SQLITE_INTEGER
:
row
->
Set
(
String
::
NewSymbol
((
char
*
)
step_req
->
column_names
[
i
]),
row
->
Set
(
String
::
NewSymbol
((
char
*
)
step_req
->
column_names
[
i
]),
Int32
::
New
(
*
(
int
*
)
(
step_req
->
column_data
[
i
])));
Int32
::
New
(
*
(
int
*
)
(
step_req
->
column_data
[
i
])));
// free((int*)(step_req->column_data[i]));
break
;
break
;
case
SQLITE_FLOAT
:
case
SQLITE_FLOAT
:
row
->
Set
(
String
::
New
(
step_req
->
column_names
[
i
]),
row
->
Set
(
String
::
New
(
step_req
->
column_names
[
i
]),
Number
::
New
(
*
(
double
*
)
(
step_req
->
column_data
[
i
])));
Number
::
New
(
*
(
double
*
)
(
step_req
->
column_data
[
i
])));
// free((double*)(step_req->column_data[i]));
break
;
break
;
case
SQLITE_TEXT
:
case
SQLITE_TEXT
:
...
@@ -854,6 +851,7 @@ protected:
...
@@ -854,6 +851,7 @@ protected:
TryCatch
try_catch
;
TryCatch
try_catch
;
step_req
->
sto
->
Unref
();
step_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
2
,
argv
);
step_req
->
cb
->
Call
(
Context
::
GetCurrent
()
->
Global
(),
2
,
argv
);
if
(
try_catch
.
HasCaught
())
{
if
(
try_catch
.
HasCaught
())
{
...
@@ -868,7 +866,6 @@ protected:
...
@@ -868,7 +866,6 @@ protected:
step_req
->
column_data
=
NULL
;
step_req
->
column_data
=
NULL
;
}
}
step_req
->
sto
->
Unref
();
return
0
;
return
0
;
}
}
...
...
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