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
635242d0
Commit
635242d0
authored
Dec 07, 2009
by
Eric Fredricksen
Committed by
Eric Fredricksen
Dec 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eliminate intermediate data structure.
parent
3b2d92ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
README
README
+13
-0
sqlite3_bindings.cc
sqlite3_bindings.cc
+4
-14
No files found.
README
View file @
635242d0
...
...
@@ -50,6 +50,19 @@ Example
});
db.close();
Install
-------
Install node. http://nodejs.org/
`$` **`hg clone https://node-sqlite.googlecode.com/hg/ node-sqlite`**
`$` **`cd node_sqlite`**
`$` **`node-waf configure`**
Build
-----
...
...
sqlite3_bindings.cc
View file @
635242d0
...
...
@@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <v8.h>
#include <node.h>
#include <node_events.h>
#include <deque>
using
namespace
v8
;
using
namespace
node
;
...
...
@@ -91,7 +90,7 @@ protected:
int
changes
=
0
;
int
param
=
0
;
std
::
deque
<
Handle
<
Array
>
>
resulting
;
Local
<
Array
>
result
(
Array
::
New
(
0
))
;
for
(;;)
{
...
...
@@ -123,7 +122,7 @@ protected:
}
}
std
::
deque
<
Handle
<
Object
>
>
rows
;
Local
<
Array
>
rosult
(
Array
::
New
(
0
))
;
for
(
int
r
=
0
;
;
++
r
)
{
int
rc
=
sqlite3_step
(
statement
);
...
...
@@ -149,7 +148,7 @@ protected:
row
->
Set
(
String
::
NewSymbol
(
sqlite3_column_name
(
statement
,
c
)),
value
);
}
ro
ws
.
push_back
(
row
);
ro
sult
->
Set
(
Integer
::
New
(
rosult
->
Length
()),
row
);
}
else
if
(
rc
==
SQLITE_DONE
)
{
break
;
}
else
{
...
...
@@ -160,24 +159,15 @@ protected:
changes
+=
sqlite3_changes
(
*
db
);
Local
<
Array
>
rosult
(
Array
::
New
(
rows
.
size
()));
std
::
deque
<
Handle
<
Object
>
>::
const_iterator
ri
(
rows
.
begin
());
for
(
int
r
=
0
;
r
<
rows
.
size
();
++
r
,
++
ri
)
rosult
->
Set
(
Integer
::
New
(
r
),
*
ri
);
rosult
->
Set
(
String
::
New
(
"rowsAffected"
),
Integer
::
New
(
sqlite3_changes
(
*
db
)));
rosult
->
Set
(
String
::
New
(
"insertId"
),
Integer
::
New
(
sqlite3_last_insert_rowid
(
*
db
)));
result
ing
.
push_back
(
rosult
);
result
->
Set
(
Integer
::
New
(
result
->
Length
()),
rosult
);
}
Local
<
Array
>
result
(
Array
::
New
(
0
));
result
->
Set
(
String
::
New
(
"rowsAffected"
),
Integer
::
New
(
changes
));
result
->
Set
(
String
::
New
(
"insertId"
),
Integer
::
New
(
sqlite3_last_insert_rowid
(
*
db
)));
std
::
deque
<
Handle
<
Array
>
>::
iterator
ri
(
resulting
.
begin
());
for
(
int
r
=
0
;
r
<
resulting
.
size
();
++
r
,
++
ri
)
{
result
->
Set
(
Integer
::
New
(
r
),
*
ri
);
}
return
result
;
}
...
...
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