Commit Graph

43 Commits

Author SHA1 Message Date
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Matteo Beccati
1e36e45d97 Allow PDO drivers custom methods to trigger errors/exceptions
Moved a few definitions from php_pdo_int.h to a new php_pdo_error.h
header file that can be included if drivers need PDO's own error
handling to be triggered within custom methods (e.g. PDO::pgsqlLOBOpen).
2013-06-04 16:49:16 +02:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00
Xinchen Hui
75a2c0d715 Merge branch 'PHP-5.4' 2012-10-09 13:30:22 +08:00
Xinchen Hui
6284ef112e Fixed bug #63236 (Executable permission on various source files) 2012-10-09 13:28:31 +08:00
Felipe Pena
e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
8775a37559 - Year++ 2012-01-01 13:15:04 +00:00
Ilia Alshanetsky
34f08a3715 Fixes for variety of issues identified by coverity scan 2011-08-07 23:46:00 +00:00
Rasmus Lerdorf
37c18f5ebe Fix more signed 1-bit bitfield, and let's use strlcpy/strlcat instead for these
static string copies
2011-08-07 16:10:34 +00:00
Rasmus Lerdorf
7eb5bbbf65 Fix more signed 1-bit bitfield, and let's use strlcpy/strlcat instead for these
static string copies
2011-08-07 16:10:34 +00:00
Rasmus Lerdorf
2449c41698 Not an issue here, but a good habit to follow consistently. Never use strcpy/strcat. 2011-08-07 15:45:18 +00:00
Rasmus Lerdorf
bfffb28ebf Not an issue here, but a good habit to follow consistently. Never use strcpy/strcat. 2011-08-07 15:45:18 +00:00
Felipe Pena
927bf09c29 - Year++ 2011-01-01 02:19:59 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Sebastian Bergmann
9ba1e81665 sed -i "s#1997-2009#1997-2010#g" **/*.c **/*.h **/*.php 2010-01-03 09:23:27 +00:00
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Dmitry Stogov
6c810b0d4c Improved memory usage by movig constants to read only memory. (Dmitry, Pierre) 2007-09-27 18:00:48 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Marcus Boerger
7bbab02633 - MFH
. Fix iterator based access
  . Add new attribute ATTR_DEFAULT_FETCH_MODE: $bdh->setAttribute()
  . Add new fetch mode: FETCH_PROPS_LATE, this fills object member
    variables after calling the constructor (fixes #36428).
2006-05-11 22:43:44 +00:00
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +00:00
foobar
3e669bc950 MFH: nuke php3 legacy 2005-12-06 02:28:41 +00:00
Wez Furlong
a750f195cd Fix Bug #34687; error information from query() not passed back 2005-10-02 22:11:19 +00:00
Marcus Boerger
991a29cfd6 - MFH PDOException base 2005-10-02 20:38:18 +00:00
Edin Kadribasic
35b7ad00a6 Declare functions used by driver as PDO_API in php_pdo_driver.h 2005-09-24 14:18:01 +00:00
Antony Dovgal
9a1c6c55b8 fix build (declare extern HashTable pdo_driver_hash) 2005-09-18 18:05:59 +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
de1d8b91f0 prep package file for release.
fix my favourite typo.
fix compile warnings
2005-03-09 05:03:58 +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
Wez Furlong
e3ba31e899 better handling of pdo-level errors 2005-02-06 21:05:59 +00:00
Wez Furlong
3a751f37c6 don't raise errors for the no-error case 2005-01-17 05:28:46 +00:00
Wez Furlong
dd842e4bf4 API support for scrollable cursors 2005-01-12 04:49:12 +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
b44785e958 don't blow up under HEAD 2004-12-26 04:50:09 +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
Wez Furlong
7937f0a229 Implement persistent connections
$dbh->exec --> $dbh->query
2004-09-23 20:07:02 +00:00
Wez Furlong
bf48daa8d5 Version 1 of PDO_FETCH_LAZY 2004-05-21 13:26:58 +00:00
Wez Furlong
5023a7c61c Enable setting the different error modes via PDO::setAttribute() 2004-05-20 19:16:49 +00:00
Wez Furlong
e7c72f8455 First cut at a "unified" error handling API. The main thing that is missing
currently is a switch in the dbh to indicate what to do with the errors.
2004-05-20 00:05:22 +00:00
Wez Furlong
79c513db96 Some pedantic fixes for gcc. 2004-05-17 17:00:35 +00:00
Wez Furlong
684be9cf36 Hello PDO.
Still more to come.  Give it a couple of days before starting to write drivers
for the other databases; a few things might change, so I'd like to coordinate
that, but in a couple of days.
2004-05-17 15:41:51 +00:00