Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit db1a504c
authored
May 06, 2013
by
Martin Aspeli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve pragma handling for sqlite3
1 parent
47f7e4c8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
lib/dialects/sqlite/connector-manager.js
lib/dialects/sqlite/connector-manager.js
View file @
db1a504
...
@@ -5,22 +5,17 @@ var Utils = require("../../utils")
...
@@ -5,22 +5,17 @@ var Utils = require("../../utils")
module
.
exports
=
(
function
()
{
module
.
exports
=
(
function
()
{
var
ConnectorManager
=
function
(
sequelize
)
{
var
ConnectorManager
=
function
(
sequelize
)
{
this
.
sequelize
=
sequelize
this
.
sequelize
=
sequelize
this
.
database
=
new
sqlite3
.
Database
(
sequelize
.
options
.
storage
||
':memory:'
)
this
.
database
=
db
=
new
sqlite3
.
Database
(
sequelize
.
options
.
storage
||
':memory:'
,
function
(
err
)
{
this
.
opened
=
false
if
(
!
err
&&
sequelize
.
options
.
foreignKeys
!==
false
)
{
// Make it possible to define and use foreign key constraints unelss
// explicitly disallowed. It's still opt-in per relation
db
.
run
(
'PRAGMA FOREIGN_KEYS=ON'
)
}
}
Utils
.
_
.
extend
(
ConnectorManager
.
prototype
,
require
(
"../connector-manager"
).
prototype
)
ConnectorManager
.
prototype
.
query
=
function
(
sql
,
callee
,
options
)
{
var
self
=
this
// Turn on foreign key checking (if the database has any) unless explicitly
// disallowed globally.
if
(
!
this
.
opened
&&
this
.
sequelize
.
options
.
foreignKeys
!==
false
)
{
this
.
database
.
serialize
(
function
()
{
self
.
database
.
run
(
"PRAGMA FOREIGN_KEYS = ON"
)
self
.
opened
=
true
})
})
}
}
Utils
.
_
.
extend
(
ConnectorManager
.
prototype
,
require
(
"../connector-manager"
).
prototype
)
ConnectorManager
.
prototype
.
query
=
function
(
sql
,
callee
,
options
)
{
return
new
Query
(
this
.
database
,
this
.
sequelize
,
callee
,
options
).
run
(
sql
)
return
new
Query
(
this
.
database
,
this
.
sequelize
,
callee
,
options
).
run
(
sql
)
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment