Commit Graph

422 Commits

Author SHA1 Message Date
Wez Furlong
f4681fd86b It's not portable to expect any consistency between drivers in the return value
of an exec() when running DDL; revise test.
2005-07-07 12:42:52 +00:00
Dmitry Stogov
0eb0b781e0 Fixed memory leaks 2005-07-07 11:19:56 +00:00
Wez Furlong
30c916f21a rename pdo_test.php to pdo_test.inc, add it, and update tests. 2005-07-06 13:19:25 +00:00
Wez Furlong
277f9357f4 juggling to track down a problem with odbc 2005-07-06 13:16:40 +00:00
Wez Furlong
72a75a87ea last minute debug stuff sneaked in 2005-07-06 06:13:44 +00:00
Wez Furlong
14dbb2dfe9 Add tests that can be redirected to with new test harness feature. 2005-07-06 06:07:26 +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
Edin Kadribasic
00855fcc34 Add sqlstates defined in PostgreSQL documentation.
Source: http://www.postgresql.org/docs/8.0/static/errcodes-appendix.html
2005-07-01 23:32:39 +00:00
Edin Kadribasic
5d65789877 Added class 55 sqlstates 2005-07-01 22:12:00 +00:00
foobar
fa6c536c26 fix tests when error_reporting is E_ALL 2005-06-28 23:33:42 +00:00
Ilia Alshanetsky
fb7c1f0561 Remove "custom" PDDRV sqlstate. 2005-06-27 14:52:46 +00:00
Ilia Alshanetsky
866283d43f Missing part of the previous patch. 2005-06-24 19:46:37 +00:00
Ilia Alshanetsky
e80a144fce Fixed PDO Mysql tests. 2005-06-24 19:10:41 +00:00
Marcus Boerger
5cf2c9dc45 - Add +ifdefs to still allow PHP 5.0 builds of PDO
# PDO is a PECL extension and at the moment is still meant to compile on
# both PHP 5.0 and PHP 5.1.
2005-06-23 00:19:16 +00:00
Dmitry Stogov
f47c78487b Improved PHP extension loading mechanism with support for module dependencies and conflicts 2005-06-17 09:39:23 +00:00
foobar
23ffaecc7d If the macro exists, use it, otherwise use the Makefile.frag 2005-06-14 13:09:23 +00:00
Wez Furlong
13ac7169af and the lesson is, test everything before you commit at 2am 2005-06-11 12:36:12 +00:00
Wez Furlong
f124c2086e couple of conceptual errors here 2005-06-11 02:50:20 +00:00
Wez Furlong
fcff6a079a "Fix" PECL #4411
SPL is not initialized before PDO, so inheriting from SPL's runtime exception class gives PDO a broken exception class.
We don't currently have a way to express this kind of "soft" dependency in the build system, so I'm disabling inheriting from the runtime exception for now.
2005-06-10 06:11:29 +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
Wez Furlong
5c16028eb5 initialize type of function 2005-06-10 04:03:43 +00:00
Dmitry Stogov
cf5a6f81e3 Fixed zval_ptr_dtor(&return_value) on uninicialized zval 2005-06-08 19:51:56 +00:00
foobar
a20383ba06 - Unify the "configure --help" texts 2005-05-29 23:17:16 +00:00
Marcus Boerger
9b3929a7e9 - Need to make PDO::__construct() final to prevent SEGV it isn't called 1st 2005-05-26 18:36:18 +00:00
Marcus Boerger
2ac0540323 - Add test for deriving PDO 2005-05-24 14:26:22 +00:00
Marcus Boerger
88157ad284 - Add new tests for PDO_FETCH_INTO 2005-05-24 12:39:09 +00:00
Marcus Boerger
0eb7282f98 - fetchSingle() was renamed to fetchColumn() 2005-05-21 14:47:33 +00:00
Ilia Alshanetsky
fa0e534f83 Various compiler warning fixes. 2005-05-18 22:40: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
Wez Furlong
e8cd91adee Allow it build with PHP 5.0.x and up again. 2005-05-14 20:06:54 +00:00
foobar
626253940e - Added PHP_INSTALL_HEADERS() macro
- Fixed several VPATH build issues
- Changed all awk calls to use $AWK
- Changed all mkdir calls to use "$php_shtool mkdir"
2005-05-07 02:51:53 +00:00
foobar
9070204b93 Only test stuff if PDO is enabled 2005-05-06 22:58:42 +00:00
Ilia Alshanetsky
3be50385ab Allocation checks around persistent allocs that can fail. 2005-04-28 00:25:25 +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
Ilia Alshanetsky
378776dc33 missing header (re2c 0.9.4 built .c file) 2005-04-14 14:01:11 +00:00
Ilia Alshanetsky
e546162f2c Added missing header. 2005-04-14 14:00:39 +00:00
Antony Dovgal
e499a1c296 fix segfault & buffer overrun when there is no PDO drivers plugged in
(patch by su1d@phpclub.net)
2005-03-29 17:23:36 +00:00
Marcus Boerger
d27be11233 - Fix null handling found by thies 2005-03-24 12:32:06 +00:00
Marcus Boerger
2906d6570c - Add new test 2005-03-24 12:31:37 +00:00
Marcus Boerger
dce82da87d - Add function pdo_drivers() 2005-03-22 10:36:25 +00:00
Marcus Boerger
73a6a31053 - the driver's key name is not zero terminated, hence we need to either
estrNcpy() it or use the driver struct.
- table headers do not support single column mode so change to two cols
- there should be only one table header
2005-03-22 10:26:51 +00:00
Marcus Boerger
a66e14645c - Add new tests 2005-03-21 00:29:25 +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
360fbc09b7 - Interface name was changed 2005-03-19 10:55:35 +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
d88b4c734f build pdo statically on win32, so sqlite2 driver will build.
Alternatively, we could build sqlite as a shared ext, but that has more
of an impact to people upgrading.
2005-03-12 01:15:37 +00:00
Marcus Boerger
92af2b6194 - Update tests 2005-03-10 17:55:36 +00:00
Magnus M��tt�
72276d013a Add NOT NULL to create so the tests work with Firebird too. 2005-03-10 02:37:20 +00:00
Wez Furlong
5984f7f3e1 prep for release 2005-03-09 18:14:49 +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
Dan Scott
e90582a990 Add test for PDOStatement::getColumnMeta().
Note that PDO_ODBC test fails as it is currently unimplemented.
2005-03-09 00:20:07 +00:00
Dan Scott
83dfcbf3f6 Add simple tests for insert through PDO::prepare/PDOStatement::execute.
Tests both question mark placeholders and named parameters.
2005-03-08 18:12:22 +00:00
Dan Scott
570976d236 Add a test for PDOStatement::columnCount(). 2005-03-08 17:39:41 +00:00
Marcus Boerger
bbccc37f84 - Add new tests 2005-03-07 22:43:27 +00:00
Marcus Boerger
efb3529b7f - Add new tests 2005-03-07 22:36:12 +00:00
Marcus Boerger
9c08e3ccae - Update signature 2005-03-07 22:27:29 +00:00
Dan Scott
48a6151051 Test PDO::beginTransaction and PDO::rollBack. 2005-03-05 21:03:12 +00:00
Marcus Boerger
f76f510185 - Add tests
- Fix testname
- Drop unnecessary include line (was wrong anyway)
2005-03-04 01:29:27 +00:00
Marcus Boerger
a4521139da - Reserve some bits for flags 2005-02-28 22:37:13 +00:00
Marcus Boerger
6ce9bcc31e - Need to drop ce until engine gets fixed 2005-02-28 19:23:56 +00:00
Marcus Boerger
eb330a95f6 - Fix warning 2005-02-28 18:44:14 +00:00
Marcus Boerger
d072f6de54 - Changing handler table definitively results in SEGVs 2005-02-28 18:40:02 +00:00
Joe Orton
bc1c0c2e12 Fix type mismatch. 2005-02-28 13:30:50 +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
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
Wez Furlong
31239f2130 *cough* 2005-02-26 16:03:55 +00:00
Wez Furlong
09fee0bf21 and the generated file 2005-02-26 15:45:43 +00:00
Wez Furlong
b4ad599df2 fix for PECL #3545 2005-02-26 15:44:38 +00:00
Wez Furlong
8be87fbab0 fix broken line endings 2005-02-26 15:35:41 +00:00
Marcus Boerger
f982890a58 - Missed during last committs somehow 2005-02-24 00:14:50 +00:00
Marcus Boerger
b786b93b7a - Delay ctor call so that it can overwrite everything and the data can
already be accessed from the ctor.
2005-02-23 23:28:30 +00:00
Marcus Boerger
40d180a87d - Reorganize ctor_args handling (fixes some bugs) 2005-02-23 00:52:46 +00:00
Marcus Boerger
effe989d91 - Show that PDOStatement implements Traversable 2005-02-23 00:52:14 +00:00
Marcus Boerger
77cf78caa1 - Make ctor args optional 2005-02-23 00:29:44 +00:00
Marcus Boerger
994006abd4 - Need to also revert operator 2005-02-22 21:22:23 +00:00
Marcus Boerger
d235a2bf4a - Put this back in (forgot to revert) 2005-02-22 20:59:52 +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
18985accc4 - Call dtor 2005-02-22 11:37:53 +00:00
Marcus Boerger
ab8f1f316b - Add new test 2005-02-21 18:55:51 +00:00
Marcus Boerger
fc2276c955 - Change tests to use ' instead of " for string values becuase that is
working for more SQL dialects.
2005-02-20 19:25:17 +00:00
Marcus Boerger
94c286f2ef - Attempt at an unified test suite 2005-02-20 17:56:19 +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
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
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
Wez Furlong
cdbe7b7afa add this note. 2005-02-18 15:39:22 +00:00
Wez Furlong
9653864fbd prep for release 2005-02-18 15:32:14 +00:00
Wez Furlong
3f0f701639 Update for pending PEAR release. 2005-02-18 01:39:36 +00:00
Wez Furlong
55f53a5a96 symlinked pdo drivers under ext.
Enabled PDO and PDO_SQLITE by default.
Fixup PDO header detection so that it searches in the correct order, and
correctly picks up the headers when building from outside of the source
tree.

TODO: make pdo_XXX auto-enable when XXX is enabled.  Volunteers welcome.
2005-02-17 04:23:15 +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
Edin Kadribasic
6ff3368e1b Simplify 2005-02-13 23:40:30 +00:00
Edin Kadribasic
14819d0f14 Allow pdo to be statically compiled in, while modules remain dynamic 2005-02-13 23:19:00 +00:00
Marcus Boerger
ef2b59f772 - Expand tests to have it work inside PHP 5.0 2005-02-13 18:13:44 +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
Marcus Boerger
746d5490cf - Use runtimeException as base if present (synch with other dbs) 2005-02-13 15:40:15 +00:00
Wez Furlong
0be93c95c9 prep for release 2005-02-13 06:56:16 +00:00
Wez Furlong
81999fdeba Fix variable declaration 2005-02-13 06:42:19 +00:00
Wez Furlong
078b77619a commit generated version of the .re 2005-02-13 06:30:36 +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
fc51fd11b6 it's only an error in emulation mode; rewrite happens in prepare, which
happens before bindParam
2005-02-13 04:00:22 +00:00
Edin Kadribasic
ab9821d8c3 Do not shout :) 2005-02-13 03:27:48 +00:00
Wez Furlong
1051e7076f Fixes the crash part of PECL Bug #3434. 2005-02-13 03:26:43 +00:00
Wez Furlong
4d80aaf47a try to handle OSX issues more gracefully 2005-02-13 01:54:59 +00:00
Ilia Alshanetsky
e5a906dcb9 Updated version without compiler warnings. 2005-02-12 20:34:20 +00:00
Wez Furlong
91eab3e5bc typo 2005-02-11 02:05:05 +00:00
Wez Furlong
1f06eb1c5c update in anticipation of a release later tonight 2005-02-11 01:22:44 +00:00
Wez Furlong
ccd242665b Fix PDO::query() for drivers that emulate bound parameters. 2005-02-11 01:20:59 +00:00
Wez Furlong
69cbb7f958 prep for release 2005-02-10 01:56:20 +00:00
Wez Furlong
3b857ea987 rename ancient method 2005-02-09 23:34:53 +00:00
Ilia Alshanetsky
ee0e2d0ea3 Touch file. 2005-02-09 17:06:13 +00:00
Ilia Alshanetsky
2196c4335b kill unused var 2005-02-09 16:14:50 +00:00
Ilia Alshanetsky
1b3dd5db8b remove unused vars. 2005-02-09 15:56:27 +00:00
Wez Furlong
94d5261f73 cosmetic changes 2005-02-09 15:12:41 +00:00
Wez Furlong
f6aa8f5d90 keep a log here for now 2005-02-09 06:44:08 +00:00
Wez Furlong
902ca8c1cf Expose the quoter method of the driver as PDO::quote().
Closes PECL Bug #3393
2005-02-09 06:43:15 +00:00
Wez Furlong
d57a169500 typo fix 2005-02-09 06:14:48 +00:00
Wez Furlong
b9a951aa1a be realistic... 2005-02-09 04:56:10 +00:00
Wez Furlong
5a2cb4154a update ready for release
# includes big hack to help guide people into running "make install" so
# that the headers get installed; works around a pear bug.
2005-02-09 04:54:56 +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
504afcfc5a and the generated file 2005-02-07 00:26:38 +00:00
Wez Furlong
2bd3536041 handle input LOBs (which are passed as streams) in bound parameter emulation.
Update error handling.
2005-02-07 00:26:22 +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
ec98e744be touch again 2005-02-06 21:05:28 +00:00
Wez Furlong
ca4dc0361c this one too 2005-02-06 17:33:12 +00:00
Wez Furlong
9ba84360e3 handle some generic attributes here 2005-02-06 17:25:09 +00:00
Wez Furlong
b2126a848a This will probably fix PECL Bug #3273 2005-02-06 16:46:18 +00:00
Wez Furlong
257dfcdde7 touch file 2005-02-06 16:29:33 +00:00
Edin Kadribasic
0d9b0606b9 Don't segault when we have placeholders but no bound params 2005-02-06 00:46:17 +00:00
Edin Kadribasic
64e8c3105c Return lobs as strings for now 2005-02-05 22:46:26 +00:00
Wez Furlong
74821473e2 update separately 2005-02-05 21:30:19 +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
7a137a5f84 fix leak 2005-01-21 04:41:52 +00:00
Wez Furlong
8ebcbfdf1b hrmm. Really really really really touch the timestamp in CVS to avoid
crappy makefile annoyance.
2005-01-21 04:34:41 +00:00
Wez Furlong
53af3dc4f2 update 2005-01-21 04:02:41 +00:00
Wez Furlong
dede3c59fe fix encoding nastiness that snuck in from the copy-n-paste of error code
descriptions from a web page.
2005-01-21 03:59:41 +00:00
Wez Furlong
88640832be and check in the generated c file later, to avoid remaking it in fresh checkouts. 2005-01-21 03:58:09 +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
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
3a751f37c6 don't raise errors for the no-error case 2005-01-17 05:28:46 +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
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
Marcus Boerger
1875caf1ab - Fix warning
- Fix tsrm usage
2005-01-08 12:35:50 +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
Wez Furlong
73186934d8 more get_method signature changes 2004-12-27 22:04:54 +00:00
Wez Furlong
b44785e958 don't blow up under HEAD 2004-12-26 04:50:09 +00:00
Marcus Boerger
dbd717591a - TSRM Fix 2004-10-28 07:47:46 +00:00
Wez Furlong
35b00ffdab Synopsis:
PDOStatement::setFetchMode()
	reset default fetch() mode for a statement to PDO_FETCH_BOTH

PDOStatement::setFetchMode(PDO_FETCH_NUM)
PDOStatement::setFetchMode(PDO_FETCH_ASSOC)
PDOStatement::setFetchMode(PDO_FETCH_BOTH)
PDOStatement::setFetchMode(PDO_FETCH_OBJ)
	set default fetch() mode for a statement.

PDOStatement::setFetchMode(PDO_FETCH_COLUMN, int colno)
	set default fetch() mode to retrieve colno-th column on each fetch() call.

PDOStatement::setFetchMode(PDO_FETCH_CLASS, string classname [, array ctor args])
	set default fetch() mode to create an instance of classname,
	calling it's ctor, passing the optional ctor args.
	The names of the columns in the result set will be used as property names on
	the object instance.  PPP rules apply.

	[NOTE: calling ctor is not yet implemented]
	[TODO: this might crash PHP for persistent PDO handles]

PDOStatement::setFetchMode(PDO_FETCH_INTO, object obj)
	Similar to PDO_FETCH_CLASS, except that each iteration will update the
	supplied object properties.

	[TODO: this might crash PHP for persistent PDO handles]

The default fetch() mode is used when no parameters are passed to
PDOStatement::fetch().  When using a statement in an iterator context,
PDOStatement::fetch() is called implicitly on each iteration.

object PDO::queryAndIterate(string sql, <PDOStatement::setFetchMode args>)
	This is semantically equivalent to:

	$stmt = $pdo->prepare($sql);
	$stmt->execute();
	$stmt->setFetchMode($args);
	return $stmt;


Example/Intended usage:

/* fetch an array with numeric and string keys */
foreach ($pdo->queryAndIterate("select NAME, VALUE from test") as $row) {
	debug_zval_dump($row);
}

/* fetch the value of column 1 into $row on each iteration */
foreach ($pdo->queryAndIterate("select NAME, VALUE from test",
		PDO_FETCH_COLUMN, 1) as $row) {
	debug_zval_dump($row); // string(3) "foo"
}

/* create a new instance of class Foo on each iteration */
foreach ($pdo->queryAndIterate("select NAME, VALUE from test",
		PDO_FETCH_CLASS, 'Foo') as $row) {
	debug_zval_dump($row);
/*
	Object(Foo)#4 (2) refcount(2){
		["NAME"]=>
  		string(12) "foo220051429" refcount(2)
		["VALUE"]=>
		string(12) "bar789825748" refcount(2)
	}
*/
}

etc.
2004-10-27 10:26:27 +00:00
Marcus Boerger
32a0465214 - Fix warning 2004-09-26 22:23:14 +00:00
Marcus Boerger
cc7ef25e4a fix build 2004-09-26 22:20:24 +00:00
Wez Furlong
eb0cd48d60 Add rough cut at fetching meta data. 2004-09-26 20:45:44 +00:00
Wez Furlong
2416481fd1 More sensible error codes in the exceptions we throw for broken transactions 2004-09-24 18:49:33 +00:00
Wez Furlong
7937f0a229 Implement persistent connections
$dbh->exec --> $dbh->query
2004-09-23 20:07:02 +00:00
Wez Furlong
ceb551024a Add support for:
$d = new PDO('foobar');  // name has no : character

This will indirect via the entry "pdo.dsn.foobar" from the php.ini file,
so if you have:

pdo.dsn.foobar=sqlite::memory:

the above is equivalent to this:

$d = new PDO('sqlite::memory:');

which creates an in-memory sqlite db.
2004-09-19 19:28:02 +00:00
Wez Furlong
797303d23a un-bogusify uri: stuff... 2004-09-19 18:11:27 +00:00
Wez Furlong
34d10931e2 Add "no permission" error code.
Add a uri: psuedo driver; it specifies the name of a resource that contains,
as its first line, the actual data source to connect to.
The resource can be a local file, or it can be any resource for which PHP
has a wrapper.

// loads connection data from the file "myapp"
$d = new PDO('uri:myapp');

// lets say that public.db.com has a read-only db open for the public
// their connection data is also published via the web:
// (not so great to resolve this on each request though...)
$d = new PDO('uri:http://public.db.com/pdo-connection-data');
2004-09-19 16:58:13 +00:00
Antony Dovgal
fdb29f9fa5 fix leak 2004-08-29 06:10:47 +00:00
Marcus Boerger
af900cb1d0 - Fix SEGV in case ctor failed 2004-07-28 00:01:12 +00:00
George Schlossnagle
c7b7791029 allow pdo to be functionally inherited from. 2004-07-26 07:42:46 +00:00
Wez Furlong
0d002664fb Implement empty-string-to-null conversion option for oracle compat.
This can be enabled using:
	$dbh->setAttribute(PDO_ATTR_ORACLE_NULLS, true);
2004-07-19 09:35:36 +00:00
Ilia Alshanetsky
905fbfd85e Added missing constant and correct bound column retrieval. When bound
columns are specified only return status (TRUE/FALSE) indicator.
2004-07-12 20:12:39 +00:00
Ilia Alshanetsky
41b639fffe Fixed function proto. 2004-07-09 17:49:08 +00:00
Ilia Alshanetsky
2ba792cd0b Don't use alloca() where it can reached by the users. 2004-07-05 21:16:29 +00:00
George Schlossnagle
9e187415f9 fix for inheritability 2004-06-23 18:06:00 +00:00
Ard Biesheuvel
18cd69ef74 Fixed some int-long issues 2004-06-23 13:20:54 +00:00
Ard Biesheuvel
f91395898c Un-revert param index fix 2004-06-15 10:22:21 +00:00
Ard Biesheuvel
e48d127244 Revert (at Wez's request) 2004-06-15 10:06:41 +00:00
Ard Biesheuvel
1d7a4ed492 Report param binding error 2004-06-13 22:09:54 +00:00
Ard Biesheuvel
cb4612c735 Added double param type 2004-06-13 10:35:01 +00:00
Ard Biesheuvel
50ac5db2b4 Added double param type
Added param struct initialiser
Reversed param parsing order (long <=> string)
2004-06-12 02:35:34 +00:00
Wez Furlong
d2a8d5a80f get/set attributes for statements 2004-05-25 18:32:48 +00:00
Wez Furlong
7a87af3321 Some definitions for cursors.
Define a mechanism for driver-specific attributes.
Use a refcount for the stmt structure.
2004-05-25 17:43:24 +00:00
Ilia Alshanetsky
cf75eb8a6f Cleanup. 2004-05-25 16:49:32 +00:00
Ilia Alshanetsky
402de24fc4 One more leak down. 2004-05-25 16:40:54 +00:00
Ilia Alshanetsky
b7ecaca17f More leak fixes. 2004-05-25 16:38:28 +00:00
Ilia Alshanetsky
0c762dff03 More possible leak fixes (Thanks Tony). 2004-05-25 14:47:22 +00:00