What"s the number scheme for "colno" for Select call in PDO driver

What"s the number scheme for "colno" for Select call in PDO driver

am 11.09.2009 14:57:00 von Sanjeev Kumar

--0016367f93691a862804734cdade
Content-Type: text/plain; charset=ISO-8859-1

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

--0016367f93691a862804734cdade--

Re: What"s the number scheme for "colno" for Select callin PDO driver

am 11.09.2009 20:53:58 von Christopher Jones

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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php