SQLSTATE[HY000]: General error: 50240 [Vertica][Support] (50240) Invalid buffer position.
I have a very simple PHP query that return an error: 50240 Invalid buffer position.
This is the code I am using to test:
$query = "select * from category where name = :nome";
$sth = $this->_lnk->prepare($query);
$category = 'Hardcore';
$sth->bindParam(':nome', $category);
$sth->execute();
- This is the trace from vertica_odbc.log:
Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Original Query: select * from category where name = ?Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Query: select * from category where name = ?Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::VQueryExecutor: +++++ enter +++++Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Initializing prepared statement: _PLAN0x284c960_0Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::InitializePreparedExecutor: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VBaseResultSet::VBaseResultSet: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VPQResultSet::VPQResultSet: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::ClearCancel: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::PopulateParameters: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetResults: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VPQResultSet::GetSelectColumns: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetResults: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLDescribeParam: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementStatePrepared::SQLDescribeParam: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLBindParameter: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementState::SQLBindParameter: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Connection::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 ConnectionState5::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 ConnectionState::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementState3::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::ClearCancel: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::FinalizePushedParamData: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::Execute: +++++ enter +++++Oct 18 13:05:59 ERROR -723515456 Statement::SQLExecute: [Vertica][Support] (50240) Invalid buffer position.
- This is the vertica.log of the database:
2013-10-18 13:08:23.278 Init Session:0x7f1558010ac0 <LOG> @v_crakrevenue_node0001: 00000/2609: Client pid: 157592013-10-18 13:08:23.278 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session autocommit to on2013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session characteristics as transaction read write2013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Command] <INFO> Setting SESSION CHARACTERISTICS to: mode 1, isolation 12013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session autocommit to on2013-10-18 13:08:23.281 Init Session:0x7f1558010ac0 [Session] <INFO> [PQuery] TX:0(avert01.verticatest.l-3305:0x17fad) select * from category where name = ?2013-10-18 13:08:23.282 Init Session:0x7f1558010ac0-a0000000005949 [Txn] <INFO> Begin Txn: a0000000005949 'select * from category where name = ?'2013-10-18 13:08:23.285 Init Session:0x7f1558010ac0-a0000000005949 <LOG> @v_crakrevenue_node0001: 00000/4719: Session avert01.verticatest.l-3305:0x17fad ended; closing connection (connCnt 6)2013-10-18 13:08:23.285 Init Session:0x7f1558010ac0-a0000000005949 [Txn] <INFO> Rollback Txn: a0000000005949 'select * from category where name = ?'
- This is the error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 50240 [Vertica][Support] (50240) Invalid buffer position. (SQLExecute[50240] at /builddir/build/BUILD/php-5.4.20/ext/pdo_odbc/odbc_stmt.c:254)' in /admin_vertica_report.class.php on line 39
The unique solution we found was not use the prepared statement.
Any thoughts?
tkx
This is the code I am using to test:
$query = "select * from category where name = :nome";
$sth = $this->_lnk->prepare($query);
$category = 'Hardcore';
$sth->bindParam(':nome', $category);
$sth->execute();
- This is the trace from vertica_odbc.log:
Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Original Query: select * from category where name = ?Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Query: select * from category where name = ?Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::VQueryExecutor: +++++ enter +++++Oct 18 13:05:59 INFO -723515456 VDataEngine::Prepare: Initializing prepared statement: _PLAN0x284c960_0Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::InitializePreparedExecutor: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VBaseResultSet::VBaseResultSet: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VPQResultSet::VPQResultSet: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::ClearCancel: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::PopulateParameters: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetResults: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VPQResultSet::GetSelectColumns: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetResults: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLDescribeParam: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementStatePrepared::SQLDescribeParam: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLBindParameter: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementState::SQLBindParameter: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Connection::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 ConnectionState5::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 ConnectionState::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 Statement::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 StatementState3::SQLExecute: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::ClearCancel: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::GetNumParams: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::FinalizePushedParamData: +++++ enter +++++Oct 18 13:05:59 TRACE -723515456 VQueryExecutor::Execute: +++++ enter +++++Oct 18 13:05:59 ERROR -723515456 Statement::SQLExecute: [Vertica][Support] (50240) Invalid buffer position.
- This is the vertica.log of the database:
2013-10-18 13:08:23.278 Init Session:0x7f1558010ac0 <LOG> @v_crakrevenue_node0001: 00000/2609: Client pid: 157592013-10-18 13:08:23.278 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session autocommit to on2013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session characteristics as transaction read write2013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Command] <INFO> Setting SESSION CHARACTERISTICS to: mode 1, isolation 12013-10-18 13:08:23.279 Init Session:0x7f1558010ac0 [Session] <INFO> [Query] TX:0(avert01.verticatest.l-3305:0x17fad) set session autocommit to on2013-10-18 13:08:23.281 Init Session:0x7f1558010ac0 [Session] <INFO> [PQuery] TX:0(avert01.verticatest.l-3305:0x17fad) select * from category where name = ?2013-10-18 13:08:23.282 Init Session:0x7f1558010ac0-a0000000005949 [Txn] <INFO> Begin Txn: a0000000005949 'select * from category where name = ?'2013-10-18 13:08:23.285 Init Session:0x7f1558010ac0-a0000000005949 <LOG> @v_crakrevenue_node0001: 00000/4719: Session avert01.verticatest.l-3305:0x17fad ended; closing connection (connCnt 6)2013-10-18 13:08:23.285 Init Session:0x7f1558010ac0-a0000000005949 [Txn] <INFO> Rollback Txn: a0000000005949 'select * from category where name = ?'
- This is the error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 50240 [Vertica][Support] (50240) Invalid buffer position. (SQLExecute[50240] at /builddir/build/BUILD/php-5.4.20/ext/pdo_odbc/odbc_stmt.c:254)' in /admin_vertica_report.class.php on line 39
The unique solution we found was not use the prepared statement.
Any thoughts?
tkx
0
Comments
But, as Wils, odbc_* works fine
Is possible to have a section in the Vertica documentation with a example using PDO?
Thank you.