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
9f039e82
Commit
9f039e82
authored
Sep 14, 2011
by
Konstantin Käfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
also check Statement objects for IsConstructCall
refs #29
parent
16ac5dc7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
statement.cc
src/statement.cc
+6
-0
database_fail.test.js
test/database_fail.test.js
+4
-0
No files found.
src/statement.cc
View file @
9f039e82
...
@@ -82,6 +82,12 @@ template <class T> void Statement::Error(T* baton) {
...
@@ -82,6 +82,12 @@ template <class T> void Statement::Error(T* baton) {
Handle
<
Value
>
Statement
::
New
(
const
Arguments
&
args
)
{
Handle
<
Value
>
Statement
::
New
(
const
Arguments
&
args
)
{
HandleScope
scope
;
HandleScope
scope
;
if
(
!
args
.
IsConstructCall
())
{
return
ThrowException
(
Exception
::
TypeError
(
String
::
New
(
"Use the new operator to create new Statement objects"
))
);
}
int
length
=
args
.
Length
();
int
length
=
args
.
Length
();
if
(
length
<=
0
||
!
Database
::
HasInstance
(
args
[
0
]))
{
if
(
length
<=
0
||
!
Database
::
HasInstance
(
args
[
0
]))
{
...
...
test/database_fail.test.js
View file @
9f039e82
...
@@ -5,6 +5,10 @@ exports['test Database() without new'] = function(beforeExit) {
...
@@ -5,6 +5,10 @@ exports['test Database() without new'] = function(beforeExit) {
assert
.
throws
(
function
()
{
assert
.
throws
(
function
()
{
sqlite3
.
Database
(
':memory:'
);
sqlite3
.
Database
(
':memory:'
);
},
(
/Use the new operator to create new Database objects/
));
},
(
/Use the new operator to create new Database objects/
));
assert
.
throws
(
function
()
{
sqlite3
.
Statement
();
},
(
/Use the new operator to create new Statement objects/
));
};
};
exports
[
'test Database#get prepare fail'
]
=
function
(
beforeExit
)
{
exports
[
'test Database#get prepare fail'
]
=
function
(
beforeExit
)
{
...
...
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