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 721eef26
authored
Feb 25, 2013
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A bit of cleanup
1 parent
2bf0668e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
lib/dialects/abstract/query.js
lib/utils.js
lib/dialects/abstract/query.js
View file @
721eef2
...
...
@@ -56,7 +56,7 @@ module.exports = (function() {
*
* @param {Array} data - The result of the query execution.
*/
AbstractQuery
.
prototype
.
formatResults
=
function
(
data
,
metaData
)
{
AbstractQuery
.
prototype
.
formatResults
=
function
(
data
)
{
var
result
=
this
.
callee
if
(
isInsertQuery
.
call
(
this
,
data
))
{
...
...
@@ -64,7 +64,7 @@ module.exports = (function() {
}
if
(
isSelectQuery
.
call
(
this
))
{
result
=
handleSelectQuery
.
call
(
this
,
data
,
metaData
)
result
=
handleSelectQuery
.
call
(
this
,
data
)
}
else
if
(
isShowTableQuery
.
call
(
this
))
{
result
=
handleShowTableQuery
.
call
(
this
,
data
)
}
else
if
(
isShowOrDescribeQuery
.
call
(
this
))
{
...
...
@@ -226,12 +226,12 @@ module.exports = (function() {
return
(
this
.
sql
.
toLowerCase
().
indexOf
(
'update'
)
===
0
)
}
var
handleSelectQuery
=
function
(
results
,
metaData
)
{
var
handleSelectQuery
=
function
(
results
)
{
var
result
=
null
,
self
=
this
;
if
(
this
.
options
.
raw
)
{
result
=
results
}
else
if
(
this
.
options
.
hasJoin
===
true
)
{
}
else
if
(
this
.
options
.
hasJoin
===
true
)
{
result
=
prepareJoinData
.
call
(
this
,
results
)
result
=
groupDataByCalleeFactory
.
call
(
this
,
result
).
map
(
function
(
result
)
{
// let's build the actual dao instance first...
...
...
lib/utils.js
View file @
721eef2
var
mysql
=
require
(
"mysql"
)
,
connection
=
mysql
.
createConnection
({})
,
util
=
require
(
"util"
)
var
util
=
require
(
"util"
)
,
DataTypes
=
require
(
"./data-types"
)
,
SqlString
=
require
(
"./SqlString"
)
var
Utils
=
module
.
exports
=
{
_
:
(
function
()
{
...
...
@@ -44,10 +43,10 @@ var Utils = module.exports = {
return
s
.
replace
(
new
RegExp
(
Utils
.
TICK_CHAR
,
'g'
),
""
)
},
escape
:
function
(
s
)
{
return
connection
.
escape
(
s
).
replace
(
/
\\
"/g
,
'"'
)
return
SqlString
.
escape
(
s
,
true
,
"local"
).
replace
(
/
\\
"/g
,
'"'
)
},
format
:
function
(
arr
)
{
return
connection
.
format
.
apply
(
connection
,
[
arr
.
shift
(),
arr
]
)
return
SqlString
.
format
(
arr
.
shift
(),
arr
)
},
isHash
:
function
(
obj
)
{
return
Utils
.
_
.
isObject
(
obj
)
&&
!
Array
.
isArray
(
obj
);
...
...
@@ -62,15 +61,6 @@ var Utils = module.exports = {
return
s
<
10
?
'0'
+
s
:
s
},
toSqlDate
:
function
(
date
)
{
// return [
// [
// date.getFullYear(),
// ((date.getMonth() < 9 ? '0' : '') + (date.getMonth()+1)),
// ((date.getDate() < 10 ? '0' : '') + date.getDate())
// ].join("-"),
// date.toLocaleTimeString()
// ].join(" ")
return
date
.
getUTCFullYear
()
+
'-'
+
this
.
pad
(
date
.
getUTCMonth
()
+
1
)
+
'-'
+
this
.
pad
(
date
.
getUTCDate
())
+
' '
+
...
...
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