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 cfce3a75
authored
Oct 02, 2014
by
Holger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* some code cleanup (after linting)
1 parent
14266ec7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
lib/dialects/sqlite/connection-manager.js
lib/sequelize.js
test/transaction.test.js
lib/dialects/sqlite/connection-manager.js
View file @
cfce3a7
...
...
@@ -23,17 +23,17 @@ ConnectionManager.prototype.getConnection = function(options) {
var
self
=
this
;
options
=
options
||
{};
options
.
uuid
=
options
.
uuid
||
'default'
;
options
.
inMemory
=
((
self
.
sequelize
.
options
.
storage
||
':memory:'
)
==
':memory:'
)?
1
:
0
;
options
.
inMemory
=
((
self
.
sequelize
.
options
.
storage
||
':memory:'
)
=
==
':memory:'
)?
1
:
0
;
if
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
])
return
Promise
.
resolve
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]);
if
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
])
return
Promise
.
resolve
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]);
return
new
Promise
(
function
(
resolve
,
reject
)
{
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]
=
new
self
.
lib
.
Database
(
self
.
sequelize
.
options
.
storage
||
':memory:'
,
function
(
err
)
{
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]
=
new
self
.
lib
.
Database
(
self
.
sequelize
.
options
.
storage
||
':memory:'
,
function
(
err
)
{
if
(
err
)
{
if
(
err
.
code
===
'SQLITE_CANTOPEN'
)
return
reject
(
'Failed to find SQL server. Please double check your settings.'
);
return
reject
(
err
);
}
resolve
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]);
resolve
(
self
.
connections
[
options
.
inMemory
||
options
.
uuid
]);
});
}).
tap
(
function
(
connection
)
{
if
(
self
.
sequelize
.
options
.
foreignKeys
!==
false
)
{
...
...
lib/sequelize.js
View file @
cfce3a7
...
...
@@ -591,7 +591,7 @@ module.exports = (function() {
).
then
(
function
(
connection
)
{
var
query
=
new
self
.
dialect
.
Query
(
connection
,
self
,
callee
,
options
);
return
query
.
run
(
sql
).
finally
(
function
()
{
if
(
options
.
transaction
||
connection
.
filename
==
":memory:"
)
return
;
if
(
options
.
transaction
||
(
connection
.
filename
===
":memory:"
)
)
return
;
return
self
.
connectionManager
.
releaseConnection
(
connection
);
});
});
...
...
test/transaction.test.js
View file @
cfce3a7
...
...
@@ -55,10 +55,10 @@ describe(Support.getTestDialectTeaser("Transaction"), function () {
});
});
if
(
dialect
==
'sqlite'
){
if
(
dialect
=
==
'sqlite'
){
it
(
'provides persistent transactions'
,
function
(
done
)
{
var
sequelize
=
new
Support
.
Sequelize
(
'database'
,
'username'
,
'password'
,
{
dialect
:
'sqlite'
});
var
User
=
sequelize
.
define
(
'user'
,
{
var
sequelize
=
new
Support
.
Sequelize
(
'database'
,
'username'
,
'password'
,
{
dialect
:
'sqlite'
}),
User
=
sequelize
.
define
(
'user'
,
{
username
:
Support
.
Sequelize
.
STRING
,
awesome
:
Support
.
Sequelize
.
BOOLEAN
});
...
...
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