Skip to content

Commit

Permalink
[CBRD-PDO#1] PDO Driver for Cubrid 10.1 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
byungwook-kim authored and kisoo-han committed Jun 30, 2017
1 parent 7e7d85e commit 7dcf040
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 28 deletions.
5 changes: 2 additions & 3 deletions cubrid_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,13 @@ static int cubrid_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquot

*quoted = (char *) emalloc(2 * unquotedlen + 18);

if ((ret = cci_escape_string(H->conn_handle, *quoted+1, unquoted, unquotedlen, &error)) < 0) {
if ((ret = cci_escape_string(H->conn_handle, *quoted, unquoted, unquotedlen, &error)) < 0) {
pdo_cubrid_error(dbh, ret, &error, NULL);
efree(*quoted);
return 0;
}
*quotedlen = ret;
(*quoted)[0] =(*quoted)[++*quotedlen] = '\'';
(*quoted)[++*quotedlen] = '\0';
(*quoted)[*quotedlen] = '\0';

return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/pdo_022.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ array(16) {
["scale"]=>
int(0)
["not_null"]=>
int(1)
int(0)
["auto_increment"]=>
int(0)
["unique_key"]=>
Expand Down
11 changes: 4 additions & 7 deletions tests/pdo_036.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@
Testing PDORow and PDOStatement instances with Reflection
--FILE--
<?php

$instance = new reflectionclass('pdorow');
$instance = new reflectionclass('pdostatement');
$x = $instance->newInstance();
var_dump($x);

$instance = new reflectionclass('pdostatement');
$instance = new reflectionclass('pdorow');
$x = $instance->newInstance();
var_dump($x);

?>
--EXPECTF--
object(PDORow)#%d (0) {
}
object(PDOStatement)#%d (1) {
[%u|b%"queryString"]=>
NULL
}

Fatal error: PDORow::__construct(): You should not create a PDOStatement manually in %spdo_036.php on line %d
16 changes: 8 additions & 8 deletions tests/pdo_038.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,43 @@ array(2) {
[0]=>
array(9) {
["PKTABLE_NAME"]=>
string(5) "event"
string(7) "athlete"
["PKCOLUMN_NAME"]=>
string(4) "code"
["FKTABLE_NAME"]=>
string(4) "game"
["FKCOLUMN_NAME"]=>
string(10) "event_code"
string(12) "athlete_code"
["KEY_SEQ"]=>
string(1) "1"
["UPDATE_RULE"]=>
string(1) "1"
["DELETE_RULE"]=>
string(1) "1"
["FK_NAME"]=>
string(18) "fk_game_event_code"
string(20) "fk_game_athlete_code"
["PK_NAME"]=>
string(13) "pk_event_code"
string(15) "pk_athlete_code"
}
[1]=>
array(9) {
["PKTABLE_NAME"]=>
string(7) "athlete"
string(5) "event"
["PKCOLUMN_NAME"]=>
string(4) "code"
["FKTABLE_NAME"]=>
string(4) "game"
["FKCOLUMN_NAME"]=>
string(12) "athlete_code"
string(10) "event_code"
["KEY_SEQ"]=>
string(1) "1"
["UPDATE_RULE"]=>
string(1) "1"
["DELETE_RULE"]=>
string(1) "1"
["FK_NAME"]=>
string(20) "fk_game_athlete_code"
string(18) "fk_game_event_code"
["PK_NAME"]=>
string(15) "pk_athlete_code"
string(13) "pk_event_code"
}
}
6 changes: 3 additions & 3 deletions tests/pdo_039.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d\nma
$db->setAttribute(PDO::ATTR_TIMEOUT, 1);
$db->setAttribute(PDO::CUBRID_ATTR_LOCK_TIMEOUT, 4);
$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
$db->setAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL, 2);
$db->setAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL, 5);

printf("\n---- PDO Attributes after set ----\n");
printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d",
printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d\n",
$db->getAttribute(PDO::ATTR_AUTOCOMMIT), $db->getAttribute(PDO::ATTR_TIMEOUT),
$db->getAttribute(PDO::CUBRID_ATTR_LOCK_TIMEOUT),$db->getAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL));
?>
Expand All @@ -45,4 +45,4 @@ client_version: %s
autocommit: 0
timeout: 1
lock_timeout: 4
isolation_level: 2
isolation_level: 5
11 changes: 5 additions & 6 deletions tests/pdo_cubrid_stmt_getcolumnmeta.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ array(16) {
["scale"]=>
int(0)
["not_null"]=>
int(1)
int(0)
["auto_increment"]=>
int(0)
["unique_key"]=>
Expand Down Expand Up @@ -65,7 +65,7 @@ array(16) {
["table"]=>
string(4) "game"
["def"]=>
string(0) ""
string(4) "NULL"
["precision"]=>
int(10)
["scale"]=>
Expand Down Expand Up @@ -99,7 +99,7 @@ array(16) {
["table"]=>
string(4) "game"
["def"]=>
string(0) ""
string(4) "NULL"
["precision"]=>
int(10)
["scale"]=>
Expand Down Expand Up @@ -133,7 +133,7 @@ array(16) {
["table"]=>
string(4) "game"
["def"]=>
string(0) ""
string(4) "NULL"
["precision"]=>
int(3)
["scale"]=>
Expand Down Expand Up @@ -167,7 +167,7 @@ array(16) {
["table"]=>
string(4) "game"
["def"]=>
string(0) ""
string(4) "NULL"
["precision"]=>
int(10)
["scale"]=>
Expand All @@ -193,4 +193,3 @@ array(16) {
["pdo_type"]=>
int(2)
}

0 comments on commit 7dcf040

Please sign in to comment.