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
e996f3df
Commit
e996f3df
authored
Sep 06, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround for broken PDO::quote() in CUBRID 9.1.0
http://jira.cubrid.org/browse/APIS-658
parent
58f8293b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
Schema.php
framework/yii/db/cubrid/Schema.php
+6
-7
CubridConnectionTest.php
tests/unit/framework/db/cubrid/CubridConnectionTest.php
+8
-0
No files found.
framework/yii/db/cubrid/Schema.php
View file @
e996f3df
...
@@ -96,18 +96,17 @@ class Schema extends \yii\db\Schema
...
@@ -96,18 +96,17 @@ class Schema extends \yii\db\Schema
*/
*/
public
function
quoteValue
(
$str
)
public
function
quoteValue
(
$str
)
{
{
throw
new
NotSupportedException
(
'quoteValue is currently broken in cubrid PDO'
);
if
(
!
is_string
(
$str
))
{
// TODO implement workaround
/* if (!is_string($str)) {
return
$str
;
return
$str
;
}
}
$this
->
db
->
open
();
$this
->
db
->
open
();
if (($value = $this->db->pdo->quote($str)) !== false) {
// workaround for broken PDO::quote() implementation in CUBRID 9.1.0 http://jira.cubrid.org/browse/APIS-658
return $value;
if
(
version_compare
(
$this
->
db
->
pdo
->
getAttribute
(
\PDO
::
ATTR_CLIENT_VERSION
),
'9.1.0'
,
'<='
))
{
} else { // the driver doesn't support quote (e.g. oci)
return
"'"
.
addcslashes
(
str_replace
(
"'"
,
"''"
,
$str
),
"
\000\n\r\\\032
"
)
.
"'"
;
return
"'"
.
addcslashes
(
str_replace
(
"'"
,
"''"
,
$str
),
"
\000\n\r\\\032
"
)
.
"'"
;
}*/
}
else
{
return
$this
->
db
->
pdo
->
quote
(
$str
);
}
}
}
/**
/**
...
...
tests/unit/framework/db/cubrid/CubridConnectionTest.php
View file @
e996f3df
...
@@ -10,4 +10,12 @@ class CubridConnectionTest extends ConnectionTest
...
@@ -10,4 +10,12 @@ class CubridConnectionTest extends ConnectionTest
$this
->
driverName
=
'cubrid'
;
$this
->
driverName
=
'cubrid'
;
parent
::
setUp
();
parent
::
setUp
();
}
}
public
function
testQuoteValue
()
{
$connection
=
$this
->
getConnection
(
false
);
$this
->
assertEquals
(
123
,
$connection
->
quoteValue
(
123
));
$this
->
assertEquals
(
"'string'"
,
$connection
->
quoteValue
(
'string'
));
$this
->
assertEquals
(
"'It''s interesting'"
,
$connection
->
quoteValue
(
"It's interesting"
));
}
}
}
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