RE: [PECL-DEV] PDO_MySQL contribution
| From: | Sam Shull | Date: | Thu, 30 Apr 2009 20:56:48 +0000 |
| Subject: | RE: [PECL-DEV] PDO_MySQL contribution | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6364@lists.php.net to get a copy of this message | ||
Would you want all three actual pages in full or just a list of the following changes that I made:
php_pdo_mysql_int.h
line: 46: Added cursor_attr property? to pdo_mysql_db_handle
enum pdo_cursor_type cursor_attr;
line: 67: Added current_position and cursor_attr properties? to pdo_mysql_stmt
long current_position;
enum pdo_cursor_type cursor_attr;
mysql_statement.c
line: 117: Initialize current_position property of pdo_mysql_stmt
S->current_position = 0;
line: 397: Added variables to initialize and for later use in pdo_mysql_stmt_fetch (I did
this because the compiler kept complaining about using them inline)
long cursor_scroll_row;
enum pdo_cursor_type cursor;
line: 430: allow cursor orientation changes if PDO::ATTR_CURSOR is not set to
PDO::CURSOR_FWDONLY
if (S->cursor_attr != PDO_CURSOR_FWDONLY && ori != PDO_FETCH_ORI_NEXT) {
switch (ori) {
/* show the last item again */
case PDO_FETCH_ORI_PRIOR:
/* only set the cursor back if it is greater than zero */
if (S->current_position > 0)
{
S->current_position -= 1;
}
mysql_data_seek(S->result, S->current_position);
break;
/* the first row in the result set */
case PDO_FETCH_ORI_FIRST:
mysql_data_seek(S->result, 0);
S->current_position = 0;
break;
/* the last row in the result set */
case PDO_FETCH_ORI_LAST:
cursor_scroll_row = mysql_num_rows(S->result);
mysql_data_seek(S->result, (cursor_scroll_row - 1));
S->current_position = cursor_scroll_row - 1;
break;
/* seek a position between 0 and mysql_num_rows(S->result) in the result set */
case PDO_FETCH_ORI_ABS:
if (offset >= 0 && offset < mysql_num_rows(S->result))
{
mysql_data_seek(S->result, offset);
S->current_position = offset;
}
break;
/* seek a position that is relative to the current position in the result set */
case PDO_FETCH_ORI_REL:
cursor_scroll_row = mysql_num_rows(S->result);
if ((S->current_position + offset) > -1 && (S->current_position
+ offset) < cursor_scroll_row)
{
S->current_position += offset;
mysql_data_seek(S->result, S->current_position);
}
break;
}
}
line: 480: update current_position property of pdo_mysql_stmt
S->current_position += 1;
file: mysql_driver.c
line: 243: set cursor_attr on pdo_mysql_stmt as part of driver options in PDO::prepare
method
S->cursor_attr = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR, H->cursor_attr
TSRMLS_CC);
line: 331: set cursor_attr on pdo_mysql_db_handle using PDO::setAttribute
case PDO_ATTR_CURSOR:
((pdo_mysql_db_handle *)dbh->driver_data)->cursor_attr =
val->value.lval;
return 1;
line: 386: get cursor_attr from pdo_mysql_db_handle using PDO::getAttribute
case PDO_ATTR_CURSOR:
ZVAL_LONG(return_value, H->cursor_attr);
return 1;
line: 507: set cursor_attr on pdo_mysql_db_handle using driver options from PDO::__construct
H->cursor_attr = pdo_attr_lval(driver_options, PDO_ATTR_CURSOR,
PDO_CURSOR_SCROLL TSRMLS_CC);
Sam Shull
sam.shull@jhspecialty.com
-----Original Message-----
From: Hannes Magnusson [mailto:hannes.magnusson@gmail.com]
Sent: Thursday, April 30, 2009 3:59 PM
To: Sam Shull
Cc: pecl-dev@lists.php.net
Subject: Re: [PECL-DEV] PDO_MySQL contribution
On Thu, Apr 30, 2009 at 21:07, Sam Shull <sam.shull@jhspecialty.com> wrote:
> I have written some updates to PDO_MYSQL that enables the cursor scroll capability. It works on
> my Ubuntu box, but I have never written anything in C before, and I am looking for some assistance
> with verifying the code is good and if so, getting it included in the main project. Any advice or
> assistance is greatly appreciated.
>
I assume there was supposed to be an attachment with this post?
Everything but text/plain gets stripped of the list..
-Hannes