Commit Graph

100 Commits

Author SHA1 Message Date
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
Marcus Boerger
07a8ea220f - Need to specify class_entry in PDO_FETCH_CLASS mode 2005-02-20 13:33:45 +00:00
Marcus Boerger
b788dc9d2a - Add fetch mode PDO_FETCH_UNIQUE 2005-02-19 23:48:30 +00:00
Marcus Boerger
a452a445cf - Simplify 2005-02-19 23:36:58 +00:00
Marcus Boerger
474fcab623 - Add PDO_FETCH_GROUP to fetchAll() 2005-02-19 23:11:23 +00:00
Marcus Boerger
41674da59f - Add full PDO_FETCH_CLASS capabilities to fetchAll() 2005-02-19 21:49:42 +00:00
Marcus Boerger
e6a5ebbdab - Default to stdClass in PDO_FETCH_CLASS mode if no classname is given 2005-02-19 21:35:31 +00:00
Marcus Boerger
f860c70362 - In fetch mode PDO_FETCH_CLASS handle constructor args
- Add PDOStatement::fetchObject
2005-02-13 17:04:04 +00:00
Wez Furlong
81999fdeba Fix variable declaration 2005-02-13 06:42:19 +00:00
Wez Furlong
0da6a84edf implement mapping of :name to ? parameters for drivers that only support ?
placeholders.
The current restriction is that you may not use the same named parameter
more than one in a given query, as there is a danger of scary things happen
with the zval if it gets bound multiple times.
2005-02-13 06:29:35 +00:00
Ilia Alshanetsky
1b3dd5db8b remove unused vars. 2005-02-09 15:56:27 +00:00
Wez Furlong
36e3ea8cb2 add input/output parameter type flag 2005-02-07 01:12:49 +00:00
Wez Furlong
ccf0a6a557 add a caller_frees parameter to get_col() to allow drivers that need
to allocate data on demand to do so without worrying about cleaning it up.

Spec out how LOB parameters are returned.
2005-02-06 22:11:12 +00:00
Wez Furlong
e3ba31e899 better handling of pdo-level errors 2005-02-06 21:05:59 +00:00
Wez Furlong
b2126a848a This will probably fix PECL Bug #3273 2005-02-06 16:46:18 +00:00
Edin Kadribasic
64e8c3105c Return lobs as strings for now 2005-02-05 22:46:26 +00:00
Wez Furlong
15e754201f pass param type to quoter functions 2005-02-05 21:29:42 +00:00
Wez Furlong
6ddbfa0733 Revise query parser so that it can rewrite from one bind syntax to another.
Expose it as PDO_API.  No drivers utilize this feature yet.
2005-01-21 03:57:06 +00:00
Wez Furlong
a39d50c95f don't propogate an unspecified length to the driver.
Drivers will used a 0 length as a hint that the parameter is an in-out or out
parameter.
2005-01-19 05:25:40 +00:00
Wez Furlong
a536e31fb1 leak/segv less 2005-01-19 03:44:49 +00:00
Wez Furlong
544d61873d proto bool PDOStatement::nextRowset()
Advances to the next rowset in a multi-rowset statement handle. Returns true if
it succeded, false otherwise
2005-01-19 01:12:52 +00:00
Wez Furlong
a9d98544de Allow drivers to select bind emulation on a per statement basis 2005-01-18 04:58:50 +00:00
Wez Furlong
8b35436cb1 remove error and hook up rowCount 2005-01-18 00:58:15 +00:00
Wez Furlong
37ea5fbeb5 Tidy up driver specific method handling 2005-01-17 23:59:16 +00:00
Wez Furlong
dd842e4bf4 API support for scrollable cursors 2005-01-12 04:49:12 +00:00
Wez Furlong
076bc75c01 add theoretical support for returning ints as ints and bools as bools.
individual drivers need to support returning data in these formats.
2005-01-12 03:26:46 +00:00
Wez Furlong
6e0d8dd06f implement SQLSTATE style error codes.
Allow drivers to add methods to dbh and stmt objects
(note that we can't use a class, because the use only sees the PDO class).
Clarify the api slightly:
  PDO::exec() is used for one-shot queries that don't return rows
  PDO::query() is a convenience function for returning a rowset without
  having to go through the steps of preparing and executing.
2005-01-07 05:23:10 +00:00