Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
598d0128
Commit
598d0128
authored
Oct 15, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added cubrid specific pdo type casting
cubrid pdo does not support PARAM_BOOL so we cast the value to integer and store 0 and 1 instead fixes #964
parent
32865c7d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
Schema.php
framework/yii/db/cubrid/Schema.php
+20
-0
CubridActiveRecordTest.php
tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
+6
-0
No files found.
framework/yii/db/cubrid/Schema.php
View file @
598d0128
...
@@ -237,4 +237,24 @@ class Schema extends \yii\db\Schema
...
@@ -237,4 +237,24 @@ class Schema extends \yii\db\Schema
}
}
return
$tableNames
;
return
$tableNames
;
}
}
/**
* Determines the PDO type for the given PHP data value.
* @param mixed $data the data whose PDO type is to be determined
* @return integer the PDO type
* @see http://www.php.net/manual/en/pdo.constants.php
*/
public
function
getPdoType
(
$data
)
{
static
$typeMap
=
array
(
// php type => PDO type
'boolean'
=>
\PDO
::
PARAM_INT
,
// PARAM_BOOL is not supported by CUBRID PDO
'integer'
=>
\PDO
::
PARAM_INT
,
'string'
=>
\PDO
::
PARAM_STR
,
'resource'
=>
\PDO
::
PARAM_LOB
,
'NULL'
=>
\PDO
::
PARAM_NULL
,
);
$type
=
gettype
(
$data
);
return
isset
(
$typeMap
[
$type
])
?
$typeMap
[
$type
]
:
\PDO
::
PARAM_STR
;
}
}
}
tests/unit/framework/db/cubrid/CubridActiveRecordTest.php
View file @
598d0128
...
@@ -32,5 +32,11 @@ class CubridActiveRecordTest extends ActiveRecordTest
...
@@ -32,5 +32,11 @@ class CubridActiveRecordTest extends ActiveRecordTest
$customer
->
refresh
();
$customer
->
refresh
();
$this
->
assertEquals
(
0
,
$customer
->
status
);
$this
->
assertEquals
(
0
,
$customer
->
status
);
$customers
=
Customer
::
find
()
->
where
(
array
(
'status'
=>
true
))
->
all
();
$this
->
assertEquals
(
2
,
count
(
$customers
));
$customers
=
Customer
::
find
()
->
where
(
array
(
'status'
=>
false
))
->
all
();
$this
->
assertEquals
(
1
,
count
(
$customers
));
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment