Re: What's the number scheme for 'colno' for Select call in PDO driver

From: Date: Fri, 11 Sep 2009 18:53:58 +0000
Subject: Re: What's the number scheme for 'colno' for Select call in PDO driver
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-46484@lists.php.net to get a copy of this message
Sanjeev Kumar wrote:
Hi, In the implemetation of Pdo-driver (extension) , what's the Sequence/Index scheme for parameter: 'colno' ? This param 'colno' is input in driver calls (of PDO statement) : int SKEL_stmt_describe_col(pdo_stmt_t *stmt, int colno TSRMLS_DC) int SKEL_stmt_get_col_data(pdo_stmt_t *stmt, int colno, ...) e.g If the script has cmds: Insert into Table test1(col1 int, col2 string, col3 real) SELECT col2,col3 from test1; The driver would which values for colno ? -sanjeev
In ext/pdo/php_pdo_driver.h: /* queries information about the type of a column, by index (0 based). * Driver should populate stmt->columns[colno] with appropriate info */ typedef int (*pdo_stmt_describe_col_func)(pdo_stmt_t *stmt, int colno TSRMLS_DC); Colno is a 0 based relative to the columns used in the query. A working example is oci_stmt_describe() in ext/pdo_oci/oci_statement.c. This callback is assigned to the "describer" field of oci_stmt_methods at the bottom of the same file. The callback gets called from pdo_stmt_describe_columns() in ext/pdo/pdo_stmt.c. Similarly, see oci_stmt_get_col() for the second skeleton function you mention. Chris -- Blog: http://blogs.oracle.com/opal Twitter: http://twitter.com/ghrd

« previous php.db (#46484) next »