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
86975eca
Commit
86975eca
authored
Jul 15, 2013
by
Dane Springmeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drop make dependency for tests - closes #150
parent
395f7804
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
Makefile
Makefile
+1
-9
createdb.js
test/support/createdb.js
+16
-6
No files found.
Makefile
View file @
86975eca
...
@@ -8,15 +8,7 @@ clean:
...
@@ -8,15 +8,7 @@ clean:
rm
-rf
./build
rm
-rf
./build
rm
-rf
./out
rm
-rf
./out
db
:
test
:
@
if
!
[
-f
test
/support/big.db
]
;
then
\
echo
"Creating test database... This may take several minutes."
;
\
node
test
/support/createdb.js
;
\
else
\
echo
"okay: database already created"
;
\
fi
test
:
db
npm
test
npm
test
.PHONY
:
build clean test
.PHONY
:
build clean test
test/support/createdb.js
100644 → 100755
View file @
86975eca
#!/usr/bin/env node
var
existsSync
=
require
(
'fs'
).
existsSync
||
require
(
'path'
).
existsSync
;
var
path
=
require
(
'path'
);
var
sqlite3
=
require
(
'../../lib/sqlite3'
);
var
sqlite3
=
require
(
'../../lib/sqlite3'
);
var
count
=
1000000
;
var
db_path
=
path
.
join
(
__dirname
,
'big.db'
);
function
randomString
()
{
function
randomString
()
{
var
str
=
''
;
var
str
=
''
;
var
chars
=
'abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY0123456789 '
;
var
chars
=
'abcdefghijklmnopqrstuvwxzyABCDEFGHIJKLMNOPQRSTUVWXZY0123456789 '
;
...
@@ -9,13 +17,14 @@ function randomString() {
...
@@ -9,13 +17,14 @@ function randomString() {
return
str
;
return
str
;
};
};
var
db
=
new
sqlite3
.
Database
(
'test/support/big.db'
);
var
count
=
1000000
;
if
(
existsSync
(
db_path
))
{
console
.
log
(
'okay: database already created ('
+
db_path
+
')'
);
db
.
serialize
(
function
()
{
}
else
{
console
.
log
(
"Creating test database... This may take several minutes."
);
var
db
=
new
sqlite3
.
Database
(
db_path
);
db
.
serialize
(
function
()
{
db
.
run
(
"CREATE TABLE foo (id INT, txt TEXT)"
);
db
.
run
(
"CREATE TABLE foo (id INT, txt TEXT)"
);
db
.
run
(
"BEGIN TRANSACTION"
);
db
.
run
(
"BEGIN TRANSACTION"
);
var
stmt
=
db
.
prepare
(
"INSERT INTO foo VALUES(?, ?)"
);
var
stmt
=
db
.
prepare
(
"INSERT INTO foo VALUES(?, ?)"
);
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
for
(
var
i
=
0
;
i
<
count
;
i
++
)
{
...
@@ -23,4 +32,5 @@ db.serialize(function() {
...
@@ -23,4 +32,5 @@ db.serialize(function() {
}
}
stmt
.
finalize
();
stmt
.
finalize
();
db
.
run
(
"COMMIT TRANSACTION"
);
db
.
run
(
"COMMIT TRANSACTION"
);
});
});
}
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