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
5f3a351c
Commit
5f3a351c
authored
Dec 09, 2018
by
Guenter Sandner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add open/close for sharedcache memory database
parent
8b817e1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
1 deletions
+36
-1
open_close.test.js
test/open_close.test.js
+36
-1
No files found.
test/open_close.test.js
View file @
5f3a351c
...
...
@@ -38,7 +38,7 @@ describe('open/close', function() {
var
db
;
it
(
'should open the database'
,
function
(
done
)
{
db
=
new
sqlite3
.
Database
(
'
test/tmp/test_create_shared.db'
,
sqlite3
.
OPEN_SHAREDCACH
E
,
done
);
db
=
new
sqlite3
.
Database
(
'
file:./test/tmp/test_create_shared.db'
,
sqlite3
.
OPEN_URI
|
sqlite3
.
OPEN_SHAREDCACHE
|
sqlite3
.
OPEN_READWRITE
|
sqlite3
.
OPEN_CREAT
E
,
done
);
});
it
(
'should close the database'
,
function
(
done
)
{
...
...
@@ -54,6 +54,41 @@ describe('open/close', function() {
});
});
describe
(
'open and close shared memory database'
,
function
()
{
var
db1
;
var
db2
;
it
(
'should open the first database'
,
function
(
done
)
{
db1
=
new
sqlite3
.
Database
(
'file:./test/tmp/test_memory.db?mode=memory'
,
sqlite3
.
OPEN_URI
|
sqlite3
.
OPEN_SHAREDCACHE
|
sqlite3
.
OPEN_READWRITE
|
sqlite3
.
OPEN_CREATE
,
done
);
});
it
(
'should open the second database'
,
function
(
done
)
{
db2
=
new
sqlite3
.
Database
(
'file:./test/tmp/test_memory.db?mode=memory'
,
sqlite3
.
OPEN_URI
|
sqlite3
.
OPEN_SHAREDCACHE
|
sqlite3
.
OPEN_READWRITE
|
sqlite3
.
OPEN_CREATE
,
done
);
});
it
(
'first database should set the user_version'
,
function
(
done
)
{
db1
.
exec
(
'PRAGMA user_version=42'
,
done
);
});
it
(
'second database should get the user_version'
,
function
(
done
)
{
db2
.
get
(
'PRAGMA user_version'
,
function
(
err
,
row
)
{
if
(
err
)
throw
err
;
assert
.
equal
(
row
.
user_version
,
42
);
done
();
});
});
it
(
'should close the first database'
,
function
(
done
)
{
db1
.
close
(
done
);
});
it
(
'should close the second database'
,
function
(
done
)
{
db2
.
close
(
done
);
});
});
it
(
'should not be unable to open an inaccessible database'
,
function
(
done
)
{
// NOTE: test assumes that the user is not allowed to create new files
// in /usr/bin.
...
...
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