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
6e391c03
Commit
6e391c03
authored
Feb 21, 2011
by
Konstantin Käfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix test suite
parent
b4fa4db2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
36 deletions
+47
-36
database.cc
src/database.cc
+10
-2
constants.test.js
test/constants.test.js
+37
-0
open_close.test.js
test/open_close.test.js
+0
-34
No files found.
src/database.cc
View file @
6e391c03
...
@@ -58,7 +58,6 @@ void Database::Process() {
...
@@ -58,7 +58,6 @@ void Database::Process() {
return
;
return
;
}
}
while
(
open
&&
(
!
locked
||
pending
==
0
)
&&
!
queue
.
empty
())
{
while
(
open
&&
(
!
locked
||
pending
==
0
)
&&
!
queue
.
empty
())
{
Call
*
call
=
queue
.
front
();
Call
*
call
=
queue
.
front
();
...
@@ -66,10 +65,12 @@ void Database::Process() {
...
@@ -66,10 +65,12 @@ void Database::Process() {
break
;
break
;
}
}
queue
.
pop
();
locked
=
call
->
exclusive
;
locked
=
call
->
exclusive
;
call
->
callback
(
call
->
baton
);
call
->
callback
(
call
->
baton
);
queue
.
pop
();
delete
call
;
delete
call
;
if
(
locked
)
break
;
}
}
}
}
...
@@ -201,7 +202,9 @@ Handle<Value> Database::Close(const Arguments& args) {
...
@@ -201,7 +202,9 @@ Handle<Value> Database::Close(const Arguments& args) {
}
}
void
Database
::
EIO_BeginClose
(
Baton
*
baton
)
{
void
Database
::
EIO_BeginClose
(
Baton
*
baton
)
{
assert
(
baton
->
db
->
locked
);
assert
(
baton
->
db
->
open
);
assert
(
baton
->
db
->
open
);
assert
(
baton
->
db
->
handle
);
assert
(
baton
->
db
->
pending
==
0
);
assert
(
baton
->
db
->
pending
==
0
);
eio_custom
(
EIO_Close
,
EIO_PRI_DEFAULT
,
EIO_AfterClose
,
baton
);
eio_custom
(
EIO_Close
,
EIO_PRI_DEFAULT
,
EIO_AfterClose
,
baton
);
}
}
...
@@ -247,6 +250,11 @@ int Database::EIO_AfterClose(eio_req *req) {
...
@@ -247,6 +250,11 @@ int Database::EIO_AfterClose(eio_req *req) {
EMIT_EVENT
(
db
->
handle_
,
2
,
args
);
EMIT_EVENT
(
db
->
handle_
,
2
,
args
);
}
}
assert
(
baton
->
db
->
locked
);
assert
(
!
baton
->
db
->
open
);
assert
(
!
baton
->
db
->
handle
);
assert
(
baton
->
db
->
pending
==
0
);
if
(
!
db
->
open
)
{
if
(
!
db
->
open
)
{
Local
<
Value
>
args
[]
=
{
String
::
NewSymbol
(
"close"
),
argv
[
0
]
};
Local
<
Value
>
args
[]
=
{
String
::
NewSymbol
(
"close"
),
argv
[
0
]
};
EMIT_EVENT
(
db
->
handle_
,
1
,
args
);
EMIT_EVENT
(
db
->
handle_
,
1
,
args
);
...
...
test/constants.test.js
0 → 100644
View file @
6e391c03
var
sqlite3
=
require
(
'sqlite3'
);
var
assert
=
require
(
'assert'
);
exports
[
'test constants'
]
=
function
()
{
assert
.
ok
(
sqlite3
.
OPEN_READONLY
===
1
);
assert
.
ok
(
sqlite3
.
OPEN_READWRITE
===
2
);
assert
.
ok
(
sqlite3
.
OPEN_CREATE
===
4
);
assert
.
ok
(
sqlite3
.
OK
===
0
);
assert
.
ok
(
sqlite3
.
ERROR
===
1
);
assert
.
ok
(
sqlite3
.
INTERNAL
===
2
);
assert
.
ok
(
sqlite3
.
PERM
===
3
);
assert
.
ok
(
sqlite3
.
ABORT
===
4
);
assert
.
ok
(
sqlite3
.
BUSY
===
5
);
assert
.
ok
(
sqlite3
.
LOCKED
===
6
);
assert
.
ok
(
sqlite3
.
NOMEM
===
7
);
assert
.
ok
(
sqlite3
.
READONLY
===
8
);
assert
.
ok
(
sqlite3
.
INTERRUPT
===
9
);
assert
.
ok
(
sqlite3
.
IOERR
===
10
);
assert
.
ok
(
sqlite3
.
CORRUPT
===
11
);
assert
.
ok
(
sqlite3
.
NOTFOUND
===
12
);
assert
.
ok
(
sqlite3
.
FULL
===
13
);
assert
.
ok
(
sqlite3
.
CANTOPEN
===
14
);
assert
.
ok
(
sqlite3
.
PROTOCOL
===
15
);
assert
.
ok
(
sqlite3
.
EMPTY
===
16
);
assert
.
ok
(
sqlite3
.
SCHEMA
===
17
);
assert
.
ok
(
sqlite3
.
TOOBIG
===
18
);
assert
.
ok
(
sqlite3
.
CONSTRAINT
===
19
);
assert
.
ok
(
sqlite3
.
MISMATCH
===
20
);
assert
.
ok
(
sqlite3
.
MISUSE
===
21
);
assert
.
ok
(
sqlite3
.
NOLFS
===
22
);
assert
.
ok
(
sqlite3
.
AUTH
===
23
);
assert
.
ok
(
sqlite3
.
FORMAT
===
24
);
assert
.
ok
(
sqlite3
.
RANGE
===
25
);
assert
.
ok
(
sqlite3
.
NOTADB
===
26
);
};
\ No newline at end of file
test/open_close.test.js
View file @
6e391c03
...
@@ -3,40 +3,6 @@ var assert = require('assert');
...
@@ -3,40 +3,6 @@ var assert = require('assert');
var
fs
=
require
(
'fs'
);
var
fs
=
require
(
'fs'
);
var
helper
=
require
(
'./support/helper'
);
var
helper
=
require
(
'./support/helper'
);
exports
[
'constants'
]
=
function
()
{
assert
.
ok
(
sqlite3
.
OPEN_READONLY
===
1
);
assert
.
ok
(
sqlite3
.
OPEN_READWRITE
===
2
);
assert
.
ok
(
sqlite3
.
OPEN_CREATE
===
4
);
assert
.
ok
(
sqlite3
.
OK
===
0
);
assert
.
ok
(
sqlite3
.
ERROR
===
1
);
assert
.
ok
(
sqlite3
.
INTERNAL
===
2
);
assert
.
ok
(
sqlite3
.
PERM
===
3
);
assert
.
ok
(
sqlite3
.
ABORT
===
4
);
assert
.
ok
(
sqlite3
.
BUSY
===
5
);
assert
.
ok
(
sqlite3
.
LOCKED
===
6
);
assert
.
ok
(
sqlite3
.
NOMEM
===
7
);
assert
.
ok
(
sqlite3
.
READONLY
===
8
);
assert
.
ok
(
sqlite3
.
INTERRUPT
===
9
);
assert
.
ok
(
sqlite3
.
IOERR
===
10
);
assert
.
ok
(
sqlite3
.
CORRUPT
===
11
);
assert
.
ok
(
sqlite3
.
NOTFOUND
===
12
);
assert
.
ok
(
sqlite3
.
FULL
===
13
);
assert
.
ok
(
sqlite3
.
CANTOPEN
===
14
);
assert
.
ok
(
sqlite3
.
PROTOCOL
===
15
);
assert
.
ok
(
sqlite3
.
EMPTY
===
16
);
assert
.
ok
(
sqlite3
.
SCHEMA
===
17
);
assert
.
ok
(
sqlite3
.
TOOBIG
===
18
);
assert
.
ok
(
sqlite3
.
CONSTRAINT
===
19
);
assert
.
ok
(
sqlite3
.
MISMATCH
===
20
);
assert
.
ok
(
sqlite3
.
MISUSE
===
21
);
assert
.
ok
(
sqlite3
.
NOLFS
===
22
);
assert
.
ok
(
sqlite3
.
AUTH
===
23
);
assert
.
ok
(
sqlite3
.
FORMAT
===
24
);
assert
.
ok
(
sqlite3
.
RANGE
===
25
);
assert
.
ok
(
sqlite3
.
NOTADB
===
26
);
};
exports
[
'open and close non-existent database'
]
=
function
(
beforeExit
)
{
exports
[
'open and close non-existent database'
]
=
function
(
beforeExit
)
{
var
opened
,
closed
;
var
opened
,
closed
;
...
...
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