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 36bcc2e9
authored
Jul 14, 2013
by
sonnym
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ability to override default module path
1 parent
346fcdb9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
7 deletions
lib/dialects/mysql/connector-manager.js
lib/dialects/postgres/connector-manager.js
lib/dialects/sqlite/connector-manager.js
lib/sequelize.js
lib/dialects/mysql/connector-manager.js
View file @
36bcc2e
...
...
@@ -4,11 +4,18 @@ var mysql
,
Utils
=
require
(
"../../utils"
)
,
without
=
function
(
arr
,
elem
)
{
return
arr
.
filter
(
function
(
e
)
{
return
e
!=
elem
})
}
try
{
mysql
=
require
(
"mysql"
)
}
catch
(
err
)
{
console
.
log
(
"You need to install mysql package manually"
);
}
module
.
exports
=
(
function
()
{
var
ConnectorManager
=
function
(
sequelize
,
config
)
{
try
{
if
(
config
.
dialectModulePath
)
{
mysql
=
require
(
config
.
dialectModulePath
)
}
else
{
mysql
=
require
(
'mysql'
)
}
}
catch
(
err
)
{
console
.
log
(
'You need to install mysql package manually'
)
}
this
.
sequelize
=
sequelize
this
.
client
=
null
this
.
config
=
config
||
{}
...
...
lib/dialects/postgres/connector-manager.js
View file @
36bcc2e
...
...
@@ -3,12 +3,14 @@ var Query = require("./query")
module
.
exports
=
(
function
()
{
var
ConnectorManager
=
function
(
sequelize
,
config
)
{
var
pgModule
=
config
.
dialectModulePath
||
'pg'
this
.
sequelize
=
sequelize
this
.
client
=
null
this
.
config
=
config
||
{}
this
.
config
.
port
=
this
.
config
.
port
||
5432
this
.
pooling
=
(
!!
this
.
config
.
poolCfg
&&
(
this
.
config
.
poolCfg
.
maxConnections
>
0
))
this
.
pg
=
this
.
config
.
native
?
require
(
'pg'
).
native
:
require
(
'pg'
)
this
.
pg
=
this
.
config
.
native
?
require
(
pgModule
).
native
:
require
(
pgModule
)
// Better support for BigInts
// https://github.com/brianc/node-postgres/issues/166#issuecomment-9514935
...
...
lib/dialects/sqlite/connector-manager.js
View file @
36bcc2e
var
Utils
=
require
(
"../../utils"
)
,
sqlite3
=
require
(
'sqlite3'
).
verbose
(
)
var
sqlite3
,
Utils
=
require
(
"../../utils"
)
,
Query
=
require
(
"./query"
)
module
.
exports
=
(
function
()
{
var
ConnectorManager
=
function
(
sequelize
)
{
var
ConnectorManager
=
function
(
sequelize
,
config
)
{
this
.
sequelize
=
sequelize
if
(
config
.
dialectModulePath
)
{
sqlite3
=
require
(
config
.
dialectModulePath
).
verbose
()
}
else
{
sqlite3
=
require
(
'sqlite3'
).
verbose
()
}
}
Utils
.
_
.
extend
(
ConnectorManager
.
prototype
,
require
(
"../connector-manager"
).
prototype
)
...
...
lib/sequelize.js
View file @
36bcc2e
...
...
@@ -14,6 +14,7 @@ module.exports = (function() {
@param {String} [password=null] The password which is used to authenticate against the database.
@param {Object} [options={}] An object with options.
@param {String} [options.dialect='mysql'] The dialect of the relational database.
@param {String} [options.dialectModulePath=null] If specified, load the dialect library from this path.
@param {String} [options.host='localhost'] The host of the relational database.
@param {Integer} [options.port=3306] The port of the relational database.
@param {String} [options.protocol='tcp'] The protocol of the relational database.
...
...
@@ -68,6 +69,7 @@ module.exports = (function() {
this
.
options
=
Utils
.
_
.
extend
({
dialect
:
'mysql'
,
dialectModulePath
:
null
,
host
:
'localhost'
,
protocol
:
'tcp'
,
define
:
{},
...
...
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