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
6357f7d2
Commit
6357f7d2
authored
Mar 26, 2010
by
Orlando Vazquez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
free column_data once we receive SQLITE_DONE
parent
31d6ecf5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
speedtest.rb
speedtest.rb
+1
-1
sqlite3_bindings.cc
sqlite3_bindings.cc
+21
-4
No files found.
speedtest.rb
View file @
6357f7d2
...
@@ -7,7 +7,7 @@ db.execute("CREATE TABLE t1 (alpha INTEGER)") do |row|
...
@@ -7,7 +7,7 @@ db.execute("CREATE TABLE t1 (alpha INTEGER)") do |row|
end
end
count
=
100000
;
count
=
100000
0
;
t0
=
Time
.
new
;
t0
=
Time
.
new
;
1
.
upto
(
count
)
do
1
.
upto
(
count
)
do
...
...
sqlite3_bindings.cc
View file @
6357f7d2
...
@@ -492,7 +492,7 @@ protected:
...
@@ -492,7 +492,7 @@ protected:
if
(
stmt_
)
sqlite3_finalize
(
stmt_
);
if
(
stmt_
)
sqlite3_finalize
(
stmt_
);
if
(
column_types_
)
free
(
column_types_
);
if
(
column_types_
)
free
(
column_types_
);
if
(
column_names_
)
free
(
column_names_
);
if
(
column_names_
)
free
(
column_names_
);
if
(
column_data_
)
free
(
column_data_
);
if
(
column_data_
)
FreeColumnData
(
);
}
}
//
//
...
@@ -824,13 +824,31 @@ protected:
...
@@ -824,13 +824,31 @@ protected:
}
}
if
(
req
->
result
==
SQLITE_DONE
&&
sto
->
column_count_
)
{
if
(
req
->
result
==
SQLITE_DONE
&&
sto
->
column_count_
)
{
free
(
sto
->
column_data_
);
sto
->
FreeColumnData
();
sto
->
column_data_
=
NULL
;
}
}
return
0
;
return
0
;
}
}
void
FreeColumnData
(
void
)
{
if
(
!
column_count_
)
return
;
for
(
int
i
=
0
;
i
<
column_count_
;
i
++
)
{
switch
(
column_types_
[
i
])
{
// XXX why does using String::New make v8 croak here?
case
SQLITE_INTEGER
:
free
(
column_data_
[
i
]);
break
;
case
SQLITE_FLOAT
:
free
(
column_data_
[
i
]);
break
;
}
column_data_
[
i
]
=
NULL
;
}
free
(
column_data_
);
column_data_
=
NULL
;
}
static
int
EIO_Step
(
eio_req
*
req
)
{
static
int
EIO_Step
(
eio_req
*
req
)
{
Statement
*
sto
=
(
class
Statement
*
)(
req
->
data
);
Statement
*
sto
=
(
class
Statement
*
)(
req
->
data
);
sqlite3_stmt
*
stmt
=
sto
->
stmt_
;
sqlite3_stmt
*
stmt
=
sto
->
stmt_
;
...
@@ -875,7 +893,6 @@ protected:
...
@@ -875,7 +893,6 @@ protected:
switch
(
sto
->
column_types_
[
i
])
{
switch
(
sto
->
column_types_
[
i
])
{
case
SQLITE_INTEGER
:
case
SQLITE_INTEGER
:
// XXX reuse this space instead of allocating every time
sto
->
column_data_
[
i
]
=
(
int
*
)
malloc
(
sizeof
(
int
));
sto
->
column_data_
[
i
]
=
(
int
*
)
malloc
(
sizeof
(
int
));
break
;
break
;
...
...
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