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 381870ca
authored
Aug 21, 2010
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed date issue
1 parent
bf894d63
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
9 deletions
lib/nodejs-mysql-native/commands.js
src/SequelizeHelper.js
src/SequelizeTable.js
lib/nodejs-mysql-native/commands.js
View file @
381870c
...
...
@@ -18,8 +18,8 @@ function xor(s1, s2)
function
parseTime
(
s
)
{
//
TODO: add real parsing
return
new
Date
()
;
//
no parsing here with non-binary prtocol, return date as is
return
s
;
}
function
parseString
(
s
)
...
...
@@ -184,7 +184,7 @@ function auth(db, user, password)
{
c
.
serverStatus
.
protocolVersion
=
r
.
bytes
(
1
);
c
.
serverStatus
.
serverVersion
=
r
.
zstring
();
c
.
serverStatus
.
threadId
=
r
.
bytes
(
4
);
c
.
serverStatus
.
threadId
=
r
.
num
(
4
);
var
salt
=
r
.
bytes
(
8
);
// TODO: whats this? comment and add fields o sercerStatus
r
.
bytes
(
1
);
...
...
@@ -263,7 +263,8 @@ function query(sql)
while
(
!
r
.
eof
())
{
var
field
=
this
.
fields
[
field_index
];
var
value
=
string2type
(
r
.
lcstring
(),
field
.
type
);
// todo: move to serialiser unpackString
var
strValue
=
r
.
lcstring
();
var
value
=
string2type
(
strValue
,
field
.
type
);
// todo: move to serialiser unpackString
this
.
store_column
(
row
,
field
,
value
)
field_index
++
;
}
...
...
@@ -420,15 +421,17 @@ function execute(sql, parameters)
var
bitmap_byte
;
if
(
this
.
ps
.
field_count
>
0
)
bitmap_byte
=
r
.
num
(
1
);
for
(
var
f
=
0
;
f
<
this
.
ps
.
field_count
;
++
f
)
var
numfields
=
this
.
ps
.
field_count
;
for
(
var
f
=
0
;
f
<
numfields
;
++
f
)
{
null_bit_map
.
push
(
(
bitmap_byte
&
bit
)
!=
0
);
if
(
!
((
bit
<<=
1
)
&
255
))
if
(
!
((
bit
<<=
1
)
&
255
)
&&
f
+
1
<
numfields
)
{
bit
=
1
;
bitmap_byte
=
r
.
num
(
1
);
}
}
var
row
=
this
.
connection
.
row_as_hash
?
{}
:
[];
for
(
var
f
=
0
;
f
<
this
.
ps
.
field_count
;
++
f
)
{
...
...
src/SequelizeHelper.js
View file @
381870c
...
...
@@ -43,7 +43,7 @@ SequelizeHelper = {
valuesForInsertQuery
:
function
(
object
)
{
var
actualValues
=
object
.
values
,
result
=
[]
SequelizeHelper
.
Hash
.
forEach
(
actualValues
,
function
(
value
,
key
)
{
var
dataType
=
object
.
table
.
attributes
[
key
]
result
.
push
(
SequelizeHelper
.
SQL
.
transformValueByDataType
(
value
,
dataType
))
...
...
src/SequelizeTable.js
View file @
381870c
...
...
@@ -10,9 +10,11 @@ SequelizeTable = function(sequelize, tableName, attributes) {
var
self
=
this
SequelizeHelper
.
Hash
.
forEach
(
values
,
function
(
value
,
key
)
{
if
(
attributes
[
key
])
{
if
(
attributes
[
key
]
==
Sequelize
.
BOOLEAN
)
{
if
(
attributes
[
key
]
.
indexOf
(
Sequelize
.
BOOLEAN
)
>
-
1
)
self
[
key
]
=
((
value
==
1
)
||
(
value
==
true
))
?
true
:
false
}
else
else
if
(
attributes
[
key
].
indexOf
(
Sequelize
.
DATE
)
>
-
1
)
self
[
key
]
=
(
value
instanceof
Date
)
?
value
:
new
Date
(
Date
.
parse
(
value
))
else
self
[
key
]
=
value
}
})
...
...
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