PHP  
 PHP_7_1
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/odbc/tests/bug47803.phpt ('Bug #47803 Executing prepared statements is succesfull only for the first two statements')

Script

1: <?php
2:
3:
include dirname(__FILE__) . "/config.inc";
4:
5:
$create_table "CREATE TABLE FOO(
6:         [PAR_ID] [int] NOT NULL,
7:         [PAR_INT] [int] NULL,
8:         [PAR_CHR] [varchar](500) NULL
9: )"
;
10:
11:
$inserts "INSERT INTO FOO
12:            ([PAR_ID]
13:            ,[PAR_INT]
14:            ,[PAR_CHR])
15:      VALUES
16:         (1,14,''),
17:         (2,30,''),
18:         (3,7,''),
19:         (4,7,''),
20:         (5,0,''),
21:         (6,0,''),
22:         (7,20130901,''),
23:         (8,20140201,''),
24:         (9,20140201,''),
25:         (10,20140620,''),
26:         (11,221,'')"
;
27:
28:
29:
date_default_timezone_set('Europe/Warsaw');
30:
31:
$link odbc_connect($dsn$user$pass);
32:
33:
odbc_exec($link'CREATE DATABASE odbcTEST');
34:
odbc_exec($link$create_table);
35:
odbc_exec($link$inserts);
36:
37:
$upd_params = array(
38:     array(
'id'=>1'name'=>'test 1'),
39:     array(
'id'=>2'name'=>'test 2'),
40:     array(
'id'=>3'name'=>'test 3'),
41:     array(
'id'=>4'name'=>'test 4'),
42:     array(
'id'=>5'name'=>'test 5'),
43:     array(
'id'=>10'name'=>'test 10'),
44:     array(
'id'=>9'name'=>'test 9'),
45:     array(
'id'=>8'name'=>'test 8'),
46:     array(
'id'=>7'name'=>'test 7'),
47:     array(
'id'=>6'name'=>'test 6'),
48: );
49:
$sql "UPDATE FOO
50:      SET [PAR_CHR] = ?
51:      WHERE [PAR_ID] = ?"
;
52:
$result odbc_prepare($link$sql);
53: if (!
$result) {
54:     print (
'[sql] prep: '.$sql);
55:     goto 
out;
56: }
57: foreach (
$upd_params as &$k) {
58:     if(!
odbc_execute($result, array($k['name'], $k['id']))) {
59:         print (
'[sql] exec: '."array({$k['name']}{$k['id']})");
60:         goto 
out;
61:     }
62: }
63:
odbc_free_result($result);
64:
65:
$sql "SELECT * FROM FOO WHERE [PAR_ID] = ?";
66:
$result odbc_prepare($link$sql);
67: if (!
$result) {
68:     print (
'[sql] prep: '.$sql);
69:     goto 
out;
70: }
71: foreach (
$upd_params as $k) { 
72:     if(!
odbc_execute($result, array($k['id']))) {
73:         print (
'[sql] exec: '."array({$k['id']})");
74:         goto 
out;
75:     }
76:     while ((
$r odbc_fetch_array($result)) !== false) {
77:         
var_dump($r);
78:     }
79: }
80:
81:
out:
82: if (
$resultodbc_free_result($result);
83:
odbc_close($link);
84:
85:
?>
86:
==DONE==
87:

Expected

array(3) {
  ["PAR_ID"]=>
  string(1) "1"
  ["PAR_INT"]=>
  string(2) "14"
  ["PAR_CHR"]=>
  string(6) "test 1"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "2"
  ["PAR_INT"]=>
  string(2) "30"
  ["PAR_CHR"]=>
  string(6) "test 2"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "3"
  ["PAR_INT"]=>
  string(1) "7"
  ["PAR_CHR"]=>
  string(6) "test 3"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "4"
  ["PAR_INT"]=>
  string(1) "7"
  ["PAR_CHR"]=>
  string(6) "test 4"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "5"
  ["PAR_INT"]=>
  string(1) "0"
  ["PAR_CHR"]=>
  string(6) "test 5"
}
array(3) {
  ["PAR_ID"]=>
  string(2) "10"
  ["PAR_INT"]=>
  string(8) "20140620"
  ["PAR_CHR"]=>
  string(7) "test 10"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "9"
  ["PAR_INT"]=>
  string(8) "20140201"
  ["PAR_CHR"]=>
  string(6) "test 9"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "8"
  ["PAR_INT"]=>
  string(8) "20140201"
  ["PAR_CHR"]=>
  string(6) "test 8"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "7"
  ["PAR_INT"]=>
  string(8) "20130901"
  ["PAR_CHR"]=>
  string(6) "test 7"
}
array(3) {
  ["PAR_ID"]=>
  string(1) "7"
  ["PAR_INT"]=>
  string(8) "20130901"
  ["PAR_CHR"]=>
  string(6) "test 7"
}
==DONE==

Output

Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Access denied for user 'odbcUser'@'localhost' to database 'odbcTEST', SQL state S1000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 33

Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_ID] [int] NOT NULL,
		[PAR_INT] [int] NULL,
		[PAR_CHR] [varchar](500) NULL' at line 2, SQL state 37000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 34

Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_ID]
           ,[PAR_INT]
           ,[PAR_CHR])
     VALUES
        (1,14,' at line 2, SQL state 37000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 35

Warning: odbc_execute(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_CHR] = 'test 1'
     WHERE [PAR_ID] = '1'' at line 2, SQL state 37000 in SQLExecute in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 58
[sql] exec: array(test 1, 1)==DONE==

Diff

001+ Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]Access denied for user 'odbcUser'@'localhost' to database 'odbcTEST', SQL state S1000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 33
002+ 
003+ Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_ID] [int] NOT NULL,
004+ 		[PAR_INT] [int] NULL,
005+ 		[PAR_CHR] [varchar](500) NULL' at line 2, SQL state 37000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 34
006+ 
007+ Warning: odbc_exec(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_ID]
008+            ,[PAR_INT]
009+            ,[PAR_CHR])
010+      VALUES
011+         (1,14,' at line 2, SQL state 37000 in SQLExecDirect in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 35
012+ 
013+ Warning: odbc_execute(): SQL error: [unixODBC][MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[PAR_CHR] = 'test 1'
014+      WHERE [PAR_ID] = '1'' at line 2, SQL state 37000 in SQLExecute in /var/php_gcov/PHP_7_1/ext/odbc/tests/bug47803.php on line 58
015+ [sql] exec: array(test 1, 1)==DONE==
001- array(3) {
002-   ["PAR_ID"]=>
003-   string(1) "1"
004-   ["PAR_INT"]=>
005-   string(2) "14"
006-   ["PAR_CHR"]=>
007-   string(6) "test 1"
008- }
009- array(3) {
010-   ["PAR_ID"]=>
011-   string(1) "2"
012-   ["PAR_INT"]=>
013-   string(2) "30"
014-   ["PAR_CHR"]=>
015-   string(6) "test 2"
016- }
017- array(3) {
018-   ["PAR_ID"]=>
019-   string(1) "3"
020-   ["PAR_INT"]=>
021-   string(1) "7"
022-   ["PAR_CHR"]=>
023-   string(6) "test 3"
024- }
025- array(3) {
026-   ["PAR_ID"]=>
027-   string(1) "4"
028-   ["PAR_INT"]=>
029-   string(1) "7"
030-   ["PAR_CHR"]=>
031-   string(6) "test 4"
032- }
033- array(3) {
034-   ["PAR_ID"]=>
035-   string(1) "5"
036-   ["PAR_INT"]=>
037-   string(1) "0"
038-   ["PAR_CHR"]=>
039-   string(6) "test 5"
040- }
041- array(3) {
042-   ["PAR_ID"]=>
043-   string(2) "10"
044-   ["PAR_INT"]=>
045-   string(8) "20140620"
046-   ["PAR_CHR"]=>
047-   string(7) "test 10"
048- }
049- array(3) {
050-   ["PAR_ID"]=>
051-   string(1) "9"
052-   ["PAR_INT"]=>
053-   string(8) "20140201"
054-   ["PAR_CHR"]=>
055-   string(6) "test 9"
056- }
057- array(3) {
058-   ["PAR_ID"]=>
059-   string(1) "8"
060-   ["PAR_INT"]=>
061-   string(8) "20140201"
062-   ["PAR_CHR"]=>
063-   string(6) "test 8"
064- }
065- array(3) {
066-   ["PAR_ID"]=>
067-   string(1) "7"
068-   ["PAR_INT"]=>
069-   string(8) "20130901"
070-   ["PAR_CHR"]=>
071-   string(6) "test 7"
072- }
073- array(3) {
074-   ["PAR_ID"]=>
075-   string(1) "7"
076-   ["PAR_INT"]=>
077-   string(8) "20130901"
078-   ["PAR_CHR"]=>
079-   string(6) "test 7"
080- }
081- ==DONE==

 

Generated at Mon, 18 Sep 2017 10:30:53 +0000 (5 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.