Commit Graph

126 Commits

Author SHA1 Message Date
Marcus Boerger
a28c82fceb - Fixed Bug #34590 User defined PDOStatement class can't implement methods 2005-09-21 22:53:50 +00:00
Dmitry Stogov
b81255d4fd ZTS fix 2005-09-12 06:31:54 +00:00
Wez Furlong
434fa24dfa Merge changes from 5.1 branch.
Add compat header that allows PDO head to compile against PHP 5.0 and PHP 5.1.
2005-09-11 05:04:00 +00:00
George Schlossnagle
fbd6ce4db5 Resolution to http://pecl.php.net/bugs/bug.php?id=5193 for all drivers. 2005-09-01 14:39:58 +00:00
Dmitry Stogov
6b622046dc zend_is_callable() and zend_make_callable() were changed to return readable function name as zval (instead of string). 2005-08-22 12:22:16 +00:00
Andrei Zmievski
c79fbfe6f3 And here 2005-08-16 19:43:23 +00:00
Dmitry Stogov
27f39c6826 Unicode support 2005-08-16 16:29:16 +00:00
Dmitry Stogov
82a504721e Unicode support 2005-08-15 16:13:02 +00:00
Dmitry Stogov
21c1109e0c Unicode support 2005-08-12 11:29:33 +00:00
Ilia Alshanetsky
ecc34bddcc Fixed memory leak. 2005-08-03 18:26:16 +00:00
Wez Furlong
bf85bf515e add sanity checks 2005-07-27 14:18:01 +00:00
Marcus Boerger
d8eece2b43 - Add missing part to make colon in parameter binding optional 2005-07-22 14:31:20 +00:00
Wez Furlong
cfe1dc3b46 this looks like a much better fix for refcounting/shutdown in lazy objects. 2005-07-22 04:33:56 +00:00
Wez Furlong
882503110d fix leak (ugh, this nuance gets me every time) 2005-07-22 02:09:19 +00:00
Wez Furlong
3560bb9c2b Fixes #33785 for me 2005-07-22 01:34:43 +00:00
Wez Furlong
be88f5a960 make a start on a debugging function. 2005-07-18 14:46:55 +00:00
Wez Furlong
9240c5f521 remember ? -> :pdox mapping so that binds by position can be mapped to names if required. 2005-07-12 03:19:44 +00:00
Wez Furlong
664ebfa499 expand oracle null handling compatability by offering the ability to convert
NULLs into empty strings as well as the other way around.  It still doesn't
help a great deal in the long run, but at least the option is there.

Make sure hash tables are nulled out to avoid double freeing them.
2005-07-12 02:40:59 +00:00
Andrey Hristov
b3aa24ff98 fix a segfault with the following script:
<?php
$dbh = new PDO('mysql:dbname=test;host=localhost', "root", "secret");
$what = 1;
$stmt = $dbh->prepare('select a, b, c from t123 where a=:what');
$stmt->bindParam(1, $what, PDO_PARAM_INT, 12);
var_dump($stmt->execute());
var_dump($stmt->fetchObject());
?>
2005-07-11 14:14:56 +00:00
Wez Furlong
d3b653e97b Added:
proto bool PDOStatement::closeCursor()
Closes the cursor, leaving the statement ready for re-execution.

The purpose of the function is to free up the connection to the server so that
other queries may be issued, but leaving the statement in a state that it can
be re-executed.

This is implemented either as an optional driver specific method (allowing for
maximum efficiency), or as the generic PDO fallback if no driver specific
function is installed.

The PDO generic fallback is semantically the same as writing the following code
in your PHP script:

do {
	while ($stmt->fetch())
		;
	if (!$stmt->nextRowset())
		break;
} while (true);
2005-07-09 03:52:41 +00:00
Wez Furlong
38a02b6244 For named-parameter-to-named-parameter rewrites, we need to map the original
names to the new names.
2005-07-08 17:00:28 +00:00
Wez Furlong
8f31f0cfaa Fix a shutdown order issue I saw in the pgsql driver. Hope this doesn't mess
up something in the OCI driver; I think I've been here before.
2005-07-08 15:25:15 +00:00
Wez Furlong
49c1882837 Add a PDO_ATTR_STRINGIFY_FETCHES attribute, which is used to convert integer or
floating point values into strings during fetch.  This is a compatibility hack
for drivers that return native types rather than string representations.

We use this flag in the test suite to persuade postgres tests to pass.
2005-07-08 04:13:00 +00:00
Ilia Alshanetsky
86028ad122 Return an empty array rather then FALSE in fetchAll() on no results. 2005-07-07 15:14:10 +00:00
Wez Furlong
68caaadc6a Fix bug in bindColumn() for drivers that implement native prepared statements
and that use the PDO rewriter to handle non-native parameter syntax.
2005-07-07 12:45:40 +00:00
Dmitry Stogov
0eb0b781e0 Fixed memory leaks 2005-07-07 11:19:56 +00:00
Wez Furlong
d4a158260b Add PDO_FETCH_NAMED; closes PECL #4641 by providing a way to access columns
by name, even when multiple columns have the same name:

$sql = "SELECT 1 a, 2 a, 3 b, 4 c, 5 d, 6 c, 7 a";
echo "$sql\n";
print_r($db->query($sql)->fetchAll(PDO_FETCH_NAMED));

Array
(
    [0] => Array
        (
            [a] => Array
                (
                    [0] => 1
                    [1] => 2
                    [2] => 7
                )

            [b] => 3
            [c] => Array
                (
                    [0] => 4
                    [1] => 6
                )

            [d] => 5
        )
)

Also added two new attributes for use at prepare time;
PDO_ATTR_FETCH_TABLE_NAMES and PDO_ATTR_FETCH_CATALOG_NAMES instruct the driver
that the names of the columns that they return to PDO should include the table
and catalog names respectively.  Both attributes may be used together or
independently.  The catalog, table and column name components should be
separated by a . character.
2005-07-03 03:49:44 +00:00
Ilia Alshanetsky
6fd9e5a64f Fixed memory leak on PDO_FETCH_OBJ. 2005-07-02 17:19:58 +00:00
Dmitry Stogov
cf5a6f81e3 Fixed zval_ptr_dtor(&return_value) on uninicialized zval 2005-06-08 19:51:56 +00:00
Ilia Alshanetsky
def27b9959 As per PDO meeting on PHP|Tropics fetchSingle is being renamed to
fetchColumn and now supports specification of the column to retrieve.
2005-05-17 01:41:51 +00:00
Ilia Alshanetsky
d30a9ee96d removed debug code. 2005-04-27 03:12:18 +00:00
Wez Furlong
7dd430ff28 fix bug #32795 2005-04-22 02:40:48 +00:00
Marcus Boerger
d27be11233 - Fix null handling found by thies 2005-03-24 12:32:06 +00:00
Marcus Boerger
c9108bba25 - Simplify code (only implement handlers that are necessary)
- Fix handling of read only property 'queryString'
- Fix overloading
- Move class init code to their defining .c files for simplification
- Mark class PDORow as final until there's a need to inherit this and
  someone implements the handlers correct then.
2005-03-21 00:29:06 +00:00
Marcus Boerger
7b2bee1d5b - Fix warnings by doing it the Zend way 2005-03-19 10:51:42 +00:00
Wez Furlong
5248f59d1a show list of PDO drivers in phpinfo.
Highlight a possible problem area; iterator leaks when used in foreach(),
at least with sqlite2 driver.
2005-03-12 01:16:59 +00:00
Wez Furlong
f7ebff804d "thou shalt not throw exceptions except in really exceptional circumstances."
The only allowed places to throw them directly are from within the PDO class
constructors or when dealing with transaction level attributes, where
"hard-failure" is a feature.

All other errors should use the PDO error handling mechanism and respect the
users selected error mode.
2005-03-09 05:50:03 +00:00
Wez Furlong
de1d8b91f0 prep package file for release.
fix my favourite typo.
fix compile warnings
2005-03-09 05:03:58 +00:00
Marcus Boerger
9c08e3ccae - Update signature 2005-03-07 22:27:29 +00:00
Marcus Boerger
6ce9bcc31e - Need to drop ce until engine gets fixed 2005-02-28 19:23:56 +00:00
Marcus Boerger
fdc3fce335 - Fix missapplied logic inversion 2005-02-28 01:08:07 +00:00
Marcus Boerger
fef7cb4e29 - Disable direct serializing for PHP 5.0 2005-02-27 22:58:08 +00:00
Marcus Boerger
6b18b88b2c - Allow default fetch mode to contain fetch flags 2005-02-27 22:48:14 +00:00
Marcus Boerger
03a4a8c11d - Add some fetch column related capailities
- Add direct (classtype based) unserializing capabilities
2005-02-27 22:32:11 +00:00
Marcus Boerger
40d180a87d - Reorganize ctor_args handling (fixes some bugs) 2005-02-23 00:52:46 +00:00
Marcus Boerger
3c743e3a98 - Allow to derive PDOStatement
- Verify fetch modes
- Add last fetch mode PDO_FETCH_FUNC (only valid inside fetchAll()) that
  allows to completley customize the way data is treated on the fly
2005-02-22 19:27:34 +00:00
Marcus Boerger
d56ce00b85 - Add fetch flag PDO_FETCH_CLASSTYPE 2005-02-20 16:12:57 +00:00
Marcus Boerger
3239a56526 - Only call the ctor once 2005-02-20 15:28:09 +00:00
Marcus Boerger
5a2620349e - Fix memleak and optimize PDO_FETCH_CLASS 2005-02-20 14:31:44 +00:00
Marcus Boerger
883ee83478 - Call ctor after initializing the props like regular db exts do 2005-02-20 13:42:03 +00:00