ODBC Prepared Statement Issues

Поиск
Список
Период
Сортировка
От Mike Jordan
Тема ODBC Prepared Statement Issues
Дата
Msg-id CAAoPOLvHnsNjJu4e6vy24qSzBkQJx+pW1zcE9gM8Z68Kji2hpg@mail.gmail.com
обсуждение исходный текст
Список 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

В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Oracle_fdw-0.9.9 make error: oci.h: No such file or directory
Следующее
От: "Francisco Figueiredo Jr."
Дата:
Сообщение: Npgsql 2.1.0-rc1 released!