From: | Mike Jordan <mtjo62(at)gmail(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | ODBC Prepared Statement Issues |
Date: | 2014-02-13 19:19:03 |
Message-ID: | CAAoPOLvHnsNjJu4e6vy24qSzBkQJx+pW1zcE9gM8Z68Kji2hpg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
I am trying to execute multiple prepared statements in PHP via the ODBC
functions. The first execution succeeds, but any proceeding executions
throws a recoverable error. This does not occur with the standard or PDO
extensions. Only Oracle has a similar issue. I tried using the standard
$1,$2,etc., binding markers and it threw a totally different error.
-------------------------------------------------------------------
Here is the PHP code:
$dbh = odbc_connect('Driver={PostgreSQL
Unicode};Trusted_Connection=yes;Server=localhost;Port=;Database=test_pgsql;','postgres','pass',SQL_CUR_USE_ODBC
);
$rs = odbc_prepare( $dbh, 'insert into rock_star (f_name,l_name)
values(?,?)' );
odbc_execute( $rs, array( 'Brian', 'Jones' ) );
echo 'Inserted 1: ' . odbc_num_rows( $rs );
odbc_execute( $rs, array( 'Rory', 'Gallagher' ) );
echo 'Inserted 2: ' . odbc_num_rows( $rs );
odbc_close( $dbh );
-------------------------------------------------------------------
Expected Results:
Inserted 1: 1
Inserted 2: 1
Actual Results:
Inserted 1: 1
Warning: odbc_execute(): SQL error: Unfortunatley couldn't get this
paramater's info, SQL state S1000 in SQLDescribeParameter in
G:\www\dev\Projects\test_odbc.php on line 26
Inserted 2: 1
Although the "Inserted 2" output returns 1, the insert is never executed.
The odbc_prepare() method does not require odbc_free_result() between
executions.
-------------------------------------------------------------------
Environment:
Windows NT BUZZ 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack
1) i586
Apache/2.4.2 (Win32) PHP/5.5.9
PostgreSQL 9.3 (x86)
PostgreSQL Unicode 9.03.01.00
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Figueiredo Jr. | 2014-02-25 18:23:16 | Npgsql 2.1.0-rc1 released! |
Previous Message | Bruce Momjian | 2014-02-13 14:59:32 | Re: Oracle_fdw-0.9.9 make error: oci.h: No such file or directory |