Commit Graph

83 Commits

Author SHA1 Message Date
Wez Furlong
bcb1fed3a7 merge PHP 5 pdo into HEAD. This source compiles on both PHP 5 and PHP 6.
If you're poking around in here, please make sure that any changes you make
compile on both PHP 5 and 6.  Thanks!
2006-12-09 22:18:43 +00:00
Antony Dovgal
16a298bc1d more 64bit fixes 2006-09-28 23:27:49 +00:00
Antony Dovgal
86eb8b4178 more 64bit fixes 2006-09-28 23:03:45 +00:00
Ilia Alshanetsky
329a7b6301 Fixed build (added missing functions) 2006-08-01 16:37:11 +00:00
Marcus Boerger
ee3a559a58 - WS 2006-03-20 22:17:41 +00:00
Marcus Boerger
56ed3211a6 - Added PDO_ATTR_DEFAULT_FETCH_MODE which controls the default fetch mode 2006-03-20 20:54:34 +00:00
Marcus Boerger
e20ff8009b - Need to change Pierre's patch abit 2006-03-18 23:35:34 +00:00
Marcus Boerger
d82abbf8d4 - Add PDO::setDEfaultFetchMode() (Pierre) 2006-03-18 23:10:40 +00:00
Marcus Boerger
e610f5959f - s/FETCH_PROPSLATE/FETCH_PROPS_LATE/ as per IRC discussion 2006-02-24 16:04:13 +00:00
Marcus Boerger
252ad86917 - Add FETCH_PROPSLATE: fetch props after calling ctor
# Fixes bug #36428
2006-02-24 15:56:03 +00:00
Antony Dovgal
d7393d2d02 fix build 2006-02-01 09:10:23 +00:00
foobar
251c5173fd bump year and license version 2006-01-01 13:10:10 +00:00
foobar
a208d9a966 - Nuke php3 legacy 2005-12-06 02:28:26 +00:00
Antony Dovgal
4329fff15f forgot to commit new pdo_attr_ function 2005-10-27 19:38:36 +00:00
Antony Dovgal
aad3dcd493 use correct enum type for the arg 2005-10-25 16:03:11 +00:00
Marcus Boerger
8ece2140cb - Add ability to change default statement class for PDO::execute()/query() 2005-10-02 18:32:05 +00:00
Edin Kadribasic
8e6b7667c6 MFB: Declare functions used by driver as PDO_API in php_pdo_driver.h 2005-09-24 14:19:24 +00:00
Wez Furlong
f6276a2b8a zts fixes 2005-08-12 23:32:31 +00:00
Ilia Alshanetsky
97e8c6f4a9 Proper handling for databases that need to pre-calculate length of large
columns, which is not normally done for performance reasons.
2005-07-20 03:38:33 +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
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
7976182b94 Fix Bug #33111 2005-07-08 19:28:52 +00:00
Wez Furlong
ab1ba644db add a bit of a hack to cater for pgsql prepared statements.
These are effectively named statements with strong constraints on the naming
format.  We cater for this in a fairly generic way: allow a driver to replace
the format string we use to generate names from positional parameters.  In
addition, if that format is set, we always force a rewrite from regular names
to the strongly enforced names.
2005-07-08 15:24:21 +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
Wez Furlong
294a44a9cb add an attribute for returning the driver name 2005-07-07 16:24:51 +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
Wez Furlong
49e7b3da4c Fix a dumb bug that would effecively ignore persistent connections and create a
new one each time.

Add a hook for persistent connections: it is called when the object goes out of
scope, and offers the driver an opportunity to release per-request scoped data
at the right time.

This hook is used by pdo_sqlite to unregister UDFs, which are dangerous to keep
registered between requests.
2005-06-10 05:47:55 +00:00
Ilia Alshanetsky
fa0e534f83 Various compiler warning fixes. 2005-05-18 22:40:56 +00:00
Marcus Boerger
a4521139da - Reserve some bits for flags 2005-02-28 22:37:13 +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
Wez Furlong
2c5b2fc105 Alan: moved your fields away, but reserved you a pointer.
Changed PDO::lastInsertId() to have following proto:

	string PDO::lastInsertId([string name])

this allows arbitrary unique identitifers to be returned from the driver.

The optional name parameter is for databases that require additional contextual
information to be able to return the correct identifier.  None currently use
it, but pgsql will be on the list of drivers that do.
2005-02-26 17:27:51 +00:00
Marcus Boerger
cb9658feef - Revert signature of PDO:prepare()
old: proto object PDO::prepare(string statment [, array driver_options [, string classname ]])
  now: proto object PDO::prepare(string statment [, array options])
  param 'classname' and and 'ctor_args' are now set through options
  using index PDO_ATTR_STATEMENT_CLASS
- Change all deriver_options parameters to 'options' to reflect the fact
  that they may contain statement as well as driver specific flags
2005-02-22 20:25:56 +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
dcf89ff197 - Bump API 2005-02-20 15:07:29 +00:00
Marcus Boerger
5a2620349e - Fix memleak and optimize PDO_FETCH_CLASS 2005-02-20 14:31:44 +00:00
Marcus Boerger
b788dc9d2a - Add fetch mode PDO_FETCH_UNIQUE 2005-02-19 23:48:30 +00:00
Marcus Boerger
474fcab623 - Add PDO_FETCH_GROUP to fetchAll() 2005-02-19 23:11:23 +00:00
Wez Furlong
6c1c64c2e7 experimental hooks for alan.
Off limits to everyone else... pretend they are not there :)
2005-02-14 15:52:06 +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
Wez Furlong
5304374fc5 fix typo 2005-02-09 00:38:11 +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
15e754201f pass param type to quoter functions 2005-02-05 21:29:42 +00:00
Wez Furlong
ebaf95b13a make this the right size... 2005-01-23 15:34:48 +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
dcd3d84ddb Eliminate unused parameter 2005-01-21 00:38:09 +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
81664bd2db Remove bogus scroll attribute.
Expose cursor constants to the script
2005-01-12 05:59:27 +00:00
Wez Furlong
dd842e4bf4 API support for scrollable cursors 2005-01-12 04:49:12 +00:00