Skip to content

Commit 7dcf040

Browse files
byungwook-kimkisoo-han
byungwook-kim
authored andcommitted
[CBRD-PDO#1] PDO Driver for Cubrid 10.1 (#2)
1 parent 7e7d85e commit 7dcf040

6 files changed

+23
-28
lines changed

cubrid_driver.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,13 @@ static int cubrid_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquot
343343

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

346-
if ((ret = cci_escape_string(H->conn_handle, *quoted+1, unquoted, unquotedlen, &error)) < 0) {
346+
if ((ret = cci_escape_string(H->conn_handle, *quoted, unquoted, unquotedlen, &error)) < 0) {
347347
pdo_cubrid_error(dbh, ret, &error, NULL);
348348
efree(*quoted);
349349
return 0;
350350
}
351351
*quotedlen = ret;
352-
(*quoted)[0] =(*quoted)[++*quotedlen] = '\'';
353-
(*quoted)[++*quotedlen] = '\0';
352+
(*quoted)[*quotedlen] = '\0';
354353

355354
return 1;
356355
}

tests/pdo_022.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ array(16) {
172172
["scale"]=>
173173
int(0)
174174
["not_null"]=>
175-
int(1)
175+
int(0)
176176
["auto_increment"]=>
177177
int(0)
178178
["unique_key"]=>

tests/pdo_036.phpt

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@
22
Testing PDORow and PDOStatement instances with Reflection
33
--FILE--
44
<?php
5-
6-
$instance = new reflectionclass('pdorow');
5+
$instance = new reflectionclass('pdostatement');
76
$x = $instance->newInstance();
87
var_dump($x);
9-
10-
$instance = new reflectionclass('pdostatement');
8+
$instance = new reflectionclass('pdorow');
119
$x = $instance->newInstance();
1210
var_dump($x);
13-
1411
?>
1512
--EXPECTF--
16-
object(PDORow)#%d (0) {
17-
}
1813
object(PDOStatement)#%d (1) {
1914
[%u|b%"queryString"]=>
2015
NULL
2116
}
17+
18+
Fatal error: PDORow::__construct(): You should not create a PDOStatement manually in %spdo_036.php on line %d

tests/pdo_038.phpt

+8-8
Original file line numberDiff line numberDiff line change
@@ -59,43 +59,43 @@ array(2) {
5959
[0]=>
6060
array(9) {
6161
["PKTABLE_NAME"]=>
62-
string(5) "event"
62+
string(7) "athlete"
6363
["PKCOLUMN_NAME"]=>
6464
string(4) "code"
6565
["FKTABLE_NAME"]=>
6666
string(4) "game"
6767
["FKCOLUMN_NAME"]=>
68-
string(10) "event_code"
68+
string(12) "athlete_code"
6969
["KEY_SEQ"]=>
7070
string(1) "1"
7171
["UPDATE_RULE"]=>
7272
string(1) "1"
7373
["DELETE_RULE"]=>
7474
string(1) "1"
7575
["FK_NAME"]=>
76-
string(18) "fk_game_event_code"
76+
string(20) "fk_game_athlete_code"
7777
["PK_NAME"]=>
78-
string(13) "pk_event_code"
78+
string(15) "pk_athlete_code"
7979
}
8080
[1]=>
8181
array(9) {
8282
["PKTABLE_NAME"]=>
83-
string(7) "athlete"
83+
string(5) "event"
8484
["PKCOLUMN_NAME"]=>
8585
string(4) "code"
8686
["FKTABLE_NAME"]=>
8787
string(4) "game"
8888
["FKCOLUMN_NAME"]=>
89-
string(12) "athlete_code"
89+
string(10) "event_code"
9090
["KEY_SEQ"]=>
9191
string(1) "1"
9292
["UPDATE_RULE"]=>
9393
string(1) "1"
9494
["DELETE_RULE"]=>
9595
string(1) "1"
9696
["FK_NAME"]=>
97-
string(20) "fk_game_athlete_code"
97+
string(18) "fk_game_event_code"
9898
["PK_NAME"]=>
99-
string(15) "pk_athlete_code"
99+
string(13) "pk_event_code"
100100
}
101101
}

tests/pdo_039.phpt

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d\nma
2222
$db->setAttribute(PDO::ATTR_TIMEOUT, 1);
2323
$db->setAttribute(PDO::CUBRID_ATTR_LOCK_TIMEOUT, 4);
2424
$db->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
25-
$db->setAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL, 2);
25+
$db->setAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL, 5);
2626

2727
printf("\n---- PDO Attributes after set ----\n");
28-
printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d",
28+
printf("\nautocommit: %d\ntimeout: %d\nlock_timeout: %d\nisolation_level: %d\n",
2929
$db->getAttribute(PDO::ATTR_AUTOCOMMIT), $db->getAttribute(PDO::ATTR_TIMEOUT),
3030
$db->getAttribute(PDO::CUBRID_ATTR_LOCK_TIMEOUT),$db->getAttribute(PDO::CUBRID_ATTR_ISOLATION_LEVEL));
3131
?>
@@ -45,4 +45,4 @@ client_version: %s
4545
autocommit: 0
4646
timeout: 1
4747
lock_timeout: 4
48-
isolation_level: 2
48+
isolation_level: 5

tests/pdo_cubrid_stmt_getcolumnmeta.phpt

+5-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ array(16) {
3737
["scale"]=>
3838
int(0)
3939
["not_null"]=>
40-
int(1)
40+
int(0)
4141
["auto_increment"]=>
4242
int(0)
4343
["unique_key"]=>
@@ -65,7 +65,7 @@ array(16) {
6565
["table"]=>
6666
string(4) "game"
6767
["def"]=>
68-
string(0) ""
68+
string(4) "NULL"
6969
["precision"]=>
7070
int(10)
7171
["scale"]=>
@@ -99,7 +99,7 @@ array(16) {
9999
["table"]=>
100100
string(4) "game"
101101
["def"]=>
102-
string(0) ""
102+
string(4) "NULL"
103103
["precision"]=>
104104
int(10)
105105
["scale"]=>
@@ -133,7 +133,7 @@ array(16) {
133133
["table"]=>
134134
string(4) "game"
135135
["def"]=>
136-
string(0) ""
136+
string(4) "NULL"
137137
["precision"]=>
138138
int(3)
139139
["scale"]=>
@@ -167,7 +167,7 @@ array(16) {
167167
["table"]=>
168168
string(4) "game"
169169
["def"]=>
170-
string(0) ""
170+
string(4) "NULL"
171171
["precision"]=>
172172
int(10)
173173
["scale"]=>
@@ -193,4 +193,3 @@ array(16) {
193193
["pdo_type"]=>
194194
int(2)
195195
}
196-

0 commit comments

Comments
 (0)