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
ae95e3c7
Commit
ae95e3c7
authored
Dec 12, 2009
by
Eric Fredricksen
Committed by
Eric Fredricksen
Dec 12, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reset and clear bindings
parent
e3e2d829
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
sqlite3_bindings.cc
sqlite3_bindings.cc
+23
-6
No files found.
sqlite3_bindings.cc
View file @
ae95e3c7
...
...
@@ -187,8 +187,8 @@ protected:
CHECK
(
sqlite3_prepare_v2
(
*
db
,
*
sql
,
-
1
,
&
stmt
,
&
tail
));
if
(
!
stmt
)
return
Null
();
Handle
<
Value
>
arg
=
External
::
New
(
stmt
);
Local
<
Object
>
statement
(
Statement
::
constructor_template
->
Local
<
Value
>
arg
=
External
::
New
(
stmt
);
Persistent
<
Object
>
statement
(
Statement
::
constructor_template
->
GetFunction
()
->
NewInstance
(
1
,
&
arg
));
if
(
tail
)
statement
->
Set
(
String
::
New
(
"tail"
),
String
::
New
(
tail
));
...
...
@@ -210,8 +210,10 @@ protected:
t
->
InstanceTemplate
()
->
SetInternalFieldCount
(
1
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"bind"
,
Bind
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"clearBindings"
,
ClearBindings
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"finalize"
,
Finalize
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"bindParameterCount"
,
BindParameterCount
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"reset"
,
Reset
);
NODE_SET_PROTOTYPE_METHOD
(
t
,
"step"
,
Step
);
//target->Set(v8::String::NewSymbol("SQLStatement"), t->GetFunction());
...
...
@@ -235,7 +237,7 @@ protected:
operator
sqlite3_stmt
*
()
const
{
return
stmt_
;
}
//
// JS
B
indings
// JS
prepared statement b
indings
//
static
Handle
<
Value
>
Bind
(
const
Arguments
&
args
)
{
...
...
@@ -264,19 +266,34 @@ protected:
return
args
.
This
();
}
static
Handle
<
Value
>
BindParameterCount
(
const
Arguments
&
args
)
{
HandleScope
scope
;
Statement
*
stmt
=
ObjectWrap
::
Unwrap
<
Statement
>
(
args
.
This
());
Local
<
Number
>
result
=
Integer
::
New
(
sqlite3_bind_parameter_count
(
*
stmt
));
return
scope
.
Close
(
result
);
}
static
Handle
<
Value
>
ClearBindings
(
const
Arguments
&
args
)
{
HandleScope
scope
;
Statement
*
stmt
=
ObjectWrap
::
Unwrap
<
Statement
>
(
args
.
This
());
SCHECK
(
sqlite3_clear_bindings
(
*
stmt
));
return
Undefined
();
}
static
Handle
<
Value
>
Finalize
(
const
Arguments
&
args
)
{
HandleScope
scope
;
Statement
*
stmt
=
ObjectWrap
::
Unwrap
<
Statement
>
(
args
.
This
());
SCHECK
(
sqlite3_finalize
(
*
stmt
));
stmt
->
stmt_
=
NULL
;
//args.This().MakeWeak();
return
Undefined
();
}
static
Handle
<
Value
>
BindParameterCoun
t
(
const
Arguments
&
args
)
{
static
Handle
<
Value
>
Rese
t
(
const
Arguments
&
args
)
{
HandleScope
scope
;
Statement
*
stmt
=
ObjectWrap
::
Unwrap
<
Statement
>
(
args
.
This
());
Local
<
Number
>
result
=
Integer
::
New
(
sqlite3_bind_parameter_coun
t
(
*
stmt
));
return
scope
.
Close
(
result
);
SCHECK
(
sqlite3_rese
t
(
*
stmt
));
return
Undefined
(
);
}
static
Handle
<
Value
>
Step
(
const
Arguments
&
args
)
{
...
...
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