DB_DataObject
pear.php.net
An SQL Builder, Object Interface to Database Tables
DataObject performs 2 tasks: 1. Builds SQL statements based on the objects vars and the builder methods. 2. acts as a datastore for a table row. The core class is designed to be extended for each of your tables so that you put the data logic inside the data classes. included is a Generator to make your configuration files and your base classes.
Alan Knowles
alan_k
alan@roojs.com yes
2015-11-10
07:31:50
1.11.5
1.9.0
stable
stable
PHP License 3.01
Minor feature and fix release.

Changes #---- - force usage of tableName - rather than direct access to __table #---- - autoJoin: check joined tables against database structure

Bugs #20536 - generator spaces after dataobject variables

Feature requests #20540 - support empty extends_location so that no require_once is generated by Generator
5.0
1.4.0b1
Date
pear.php.net
1.4.3
DB
pear.php.net
1.7.0
MDB2
pear.php.net
2.0.0RC1
Validate
pear.php.net
0.1.1
2015-04-08
1.11.4
1.9.0
stable
stable
PHP License 3.01
Minor feature and fix release. (Basically a yearly release now..)

#20291 Ignored in update $dao->field = 0 (fix bad check for null) #20149 - correct free for linked objects / more detailed error reporting on update error #19962 - Cannot insert or update when part of a reference in multi-key case is NULL by vtamma #19973 - accept START TRANSACTION as an alias for BEGIN - suuport for useindex (mysql only) and #19922 - pear error not being set in static property. - fix static infront of depricated staticget() method and fix call to PEAR:: static calls. - Fix some static errors that are now fatal unfortunatly... - fix building of autojoin when using distinct columns
2014-04-22
1.11.3
1.9.0
stable
stable
PHP License 3.01
Minor feature and fix release. (Basically a yearly release now..) #19922 - fix for pear error not being set in static property. #19973 - accept START TRANSACTION as an alias for BEGIN #19962 - Cannot insert or update when part of a reference in multi-key case is NULL by vtamma #20149 - correct free for linked objects / more detailed error reporting on update error - fix building of autojoin when using distinct columns
2013-04-05
1.11.2
1.9.0
stable
stable
PHP License 3.01
(re-release of 1.11.0 - to fix archive tar issue. / fix dependancy)

Minor feature and fix release. (Basically a yearly release now..)

Dependancies

MDB2 and DB are now optional dependancies, although one of them is required.

AutoJoin - improvements - support sqlValue and DB_DataObject_Cast values in setFrom() - correct filtering - diff and intersect... so additional cols do not get injected by exclude.. - autoJoin( "exclude" => array( "col1", "col2") ) should now exclude the columns from selectAdd/As - correctly handle include in autojoin - based on derived column names - autojoin now supports include and distinct, and returns count as the column to count on + handles Closure on debugging output of config

Other Changes - add limited support for building derived table queries - which can speed up mysql queries hugely when using distinct/limit

Removed / changed / depricated - remove PHP4 support - Make staticGet depricated in generator and main code (move to end of file with rest of depricated stuff..

Minor fixes - fix signature on depricated staticGet method - fix typo in links code DO::getLinks() - fix is_a syntax error - RTFM might be a good idea - check return value from generator - remove blob test from stringtostring code..

Bug Fixes

#19697 - str_replace only if needed to reduce memory - and move staticAutoloadTAble to depricated section #19637 - strip support with regex broke boolean settings #19640 - indentation not correct on generator

#19500 - use same way that pear db mssql driver quotes for regular strings (tidy up) #19500 - support for mssql in DataObject Cast #19505 - simplify the proxy loading code detection and usage. #19479 - simpler test should do the job #19479 - link loaded test was incorrect #19475 - comment out a few echos that got left in
2013-04-03
1.10.0
1.9.0
stable
stable
PHP License 3.01
Minor feature and fix release.

#----- - Fix transactions - query(BEGIN) did not actually run when called. #----- - Refactor Link and join code - link code moved to DB_DataObject_Link, new option generate_link_methods, new method link() - make the links option work with autojoin, add setter feature to links() - support links option on autojoin - add support for excluded columns on autoJoin - more detailed check on assigning numbers in link() - new link syntax in generated methods - make links() support same array syntax as joinAdd(), and change links() to support input as func_get_args() for the second argument, cleans up wrapper code.. - support joinAdd(array("local_col", $dataObject, "remote_col"), "LEFT"), extra debugging on count(), and case sensitive checking on numRows (not sure if that was needed..)

#----- - remove notes relating to MDB as they are not relivant anymore #----- - SVN/git has new directory layout

#----- - Add pid() - a quick way to get the value from the primary "id" column of the database #----- - add sqlValue() - a factory method to create a DB_DataObject_Cast Object #----- - nice warning on failed to write to temporary file #----- - fixes to correctly support portability in selectAs() #----- - fixes to correctly support portability in joinAdd

#----- - lower case links and ini during load, when portability set, fix handling in joinAdd

#----- - add experimental support for posgresql introspected native keys

#----- - move assignment to error in raiseError after it actually happens, this should ensure _lastError gets set correctly as the aliased setting does not appear to work very well.. #----- - find() will return false when an error occurs (rather than 0) #18995 - Remove error_reporting settings from tests (closes bug #18995). #18931 - typos in comments - rasmus would appreciate this one... (depreciated to depricated) #----- - support ini_database in foreign key generation, and regex matching on strip schema #----- - document change to generator_strip_schema which now supports regexp to strip from matching schemas #----- - add support for portability in tableName() - most references to tablename will now call tablename, so that code working on mysql can work on postgres, where tables are mixed case in mysql. #----- - document build_views change #----- - support _TEXT type (postgres view returns this.) #----- - support build_views=schema.views for building dataobjects from views with schemas #18767 - use argv0 for the usage line, and ensure that is is run from cli sapi
2011-08-29
1.9.6
1.9.0
stable
stable
PHP License 3.01
Small fix release.

#18749 - Fix is_a() for 5.3.7+ due to php-core stupidity #18602 - optimize fetch - thanks to shadesofgraylin #18605 - optimize sprintf in toArray() #18446 - use table() method rather than accessing static global. #----- - toArray support for only returning returned columns use "0" as the second parameter #----- - allow tableless dataobject connect() call to work #----- - disable overload using DB_DATAOBJECT_NO_OVERLOAD on PHP5 - Im supprised no one ever noticed this - overload is EVIL ;) #----- - Add autoJoin method, which will build a full join with all related tables. #16867 - fix doc comments - change to public methods for the ones that are supposed to be overridden #17637 - fix detection of non-existant links files resulting in defaulting to autolinks
2010-07-07
1.9.5
1.9.0
stable
stable
PHP License 3.01
Small fix release.

fix bug #17554 - update when id=0 (or primary key is 0) - thanks to the persistance of Jacek Pawlowski
2010-06-21
1.9.4
1.9.0
stable
stable
PHP License 3.01
Bug Fixes #17508 - whereAddIn used wrong method to quote strings #6202 - better docs on getLinkArray - needs documentation as well really.. #17343 - tidy up padding code, - fix alignnment of comments in generated files (Original Patch by madsliejensen) #17289 - fix sequence_<table> = XXXXX (madsliejensen) #17157 - use property_exists in newer versions of php.

New Features #7590 - union support - thanks to Ian Carmichael #----- - whereAdd in support for negative (prefix column with '!') and empty arrays forces 1=0 query. #13798 - add hookpostvar for adding things like varchar len data etc.. as per req #16267 - Linking Multiple foreign keys - supports links.ini id[] = table1:col1 id[] =... #17049 - generate links.ini for postgres - by madsliejensen
2010-01-15
1.9.3
1.9.0
stable
stable
PHP License 3.01
Fix broken release (1.9.1 and 1.9.2)

fetchAll() / whereAddIn() Release version.

This version adds two new utility methods, that can speed up usage, fetchAll() - does the $do->find() / while($do->fetch()) $ar[] = clone($do) loop, and more. whereAddIn() - allows you to quickly build IN queries, with correct escaping.
2009-12-03
1.9.0
1.9.0
stable
stable
PHP License 3.01
Modular Release version.

This version was designed to support multiple locations of DataObjects for use with modular applications. - NOTE the change to ini_DATABASENAME may fixes the previous behaviour to match the documented behaviour - however this may break existing installations.

New Features: #------- class_location accepts multiple locations with PATH_SEPARATOR #------- class_prefix accepts multiple prefixes with PATH_SEPARATOR #------- ini_DATABASENAME merges all found ini files in paths (seperated by PATH_SEPARATOR) previous behaviour was just to read the first. - this applies to matching links.ini files. #12550 - disable_null_strings=full -- see the bug report for details - it is highly recommended not to use this feature, as it may result in data being deleted from your database if not used carefully.

Notes: #------- staticGet now marked depreciated. #------- links_DATABASENAME does not support multiple paths #------- staticAutoloadTable (depreciated) and staticGet (depreciated) do not support this feature
2009-08-12
1.8.12
1.8.6
stable
stable
PHP License 3.01
Licence upgrade Release #----- - Changed Error and Cast Licence to 3.01 to keep Debian/Ubuntu happy.
2009-07-16
1.8.11
1.8.6
stable
stable
PHP License 3.01
Licence upgrade Release #----- - Licence changed to 3.01 to keep Debian/Ubuntu happy. #----- - Change order of preference for links in JoinAdd - prefer called table links over jointo table. #----- - Retry support for connection failure on queries #----- - Factory now uses '/' for database/table seperator (experimental) #----- - Fix INSERT on Postresql with empty data.
2009-03-19
1.8.10
1.8.6
stable
stable
PHP License 3.01
Annual Release - Minor Bugfixs / Extra Features

#----- - Fix factory error with database name not found #----- - Change factory multi-database call to use '/' rather than '.' so that it can work with postgres (also syncs with what the original notes said)
2009-03-12
1.8.9
1.8.6
stable
stable
PHP License
Annual Release - Minor Bugfixs / Extra Features

#15066 - limited support for POINT (at least generator creates something) #14976 - add option generator_omit_database_var to prevent creation of $database lines (Troy Anderson) #13995 - incorrect test in sequence key for postgres #14252 - doc comments on delete() corrected to say return value is no. of rows affected on success

###### - ensure that tableinfo uses quote_identifiers_tableinfo ###### - add sqlite support to Cast blobs ###### - old skipEmpty check broke formating on setFrom ###### - remove previous checks on database dsn lookup - move it to factory. ###### - Fix count check for no keys. - By Jeffrey Pfau ###### - Add multidatabase factory() support - eg. DB_DataObject::factory("mydatabase.mytable"); ###### - Added checks to ensure that database names match requested ones. #13773 - delete(true) honours join conditions #13788 - test for error before re-writing definition table for MDB2 in Generator #13789 - honour user specified MDB2 options in Generator #13790 - support CLOB oracle #12993 - add new option generator_secondary_key_match - set to false, to disable key matching for secondary key types
2008-01-30
1.8.8
1.8.6
stable
stable
PHP License
Minor Bugfix / Feature Release

Pre-chinese new year release (with lots of 8's...)

Bug Fixes #12556 - Generator - pregmatch appears broken for replacing class name on updating files #10112 - additional config option quote_identifiers_tableinfo for use with tableinfo on generator Fixes issues with Oracle and quoting identifiers. #11773 - problems with object->array[prop] setting on PHP5.2.3 ** this may also have been fixed twice by fix for #11775 #12858 - MDB2 and postgres missing db_driver variable #9902 - default portability options for MDB2 to not fix case. #9658 - postgres DECIMAL using DB backend incorrectly flagged as unknown - changed warning to suggest using MDB2 #11091 - count attempted to read quote identifiers before config was loaded #11804 - insert with postgres/msql return wrong error message #9364 - fix postgres native sequences with MDB #11775 - unsetting of $this->_query causes overload setters/getters to handle later uses of _query and break due to lack of array accessor support #11634 - Windows fails to rename files if they exist - affecting Generator (try and fix it so unix is still atomic)
2007-07-12
1.8.7
1.8.6
stable
stable
PHP License
Minor Bugfix Release

Bug Fixes: #11586 - missing default value in Generator for class_prefix caused warning #11584 - typo in Generator caused permissions to be incorrectly set on ini file.
2007-07-10
1.8.6
1.8.6
stable
stable
PHP License
Minor Bugfix and Minor Feature addition release

Bug Fixes: #11483 - show an error if pcre limits are not correctly set and generator tries to generate empty files #11528 - sending like queries to escape does not escape % and _ - added additional parameter to escape : [bool $likeEscape] is optional and can be used to force escaping of these characters #10573 - fix permissions on generated files #10573 - write Generated files to temp directory, then rename into place. - fixing locking issues #10531 - correct fix for bug #9628 (support MDB2 for defaults()) #10454 - mssql uses wrong variable name for options. #10175 - MDB2 does not return length value #9573 - enable disable_null_strings to turn of "null"-> NULL replacements #9625 - MDB2 support for MSSQL sequencies #9644 - incorrect constant in foriegn key generation. #9628 - support MDB2 for defaults() #9839 - Invalid column names can not be supported, so warning is generated #9834 - SQL2003 standards on Joins - adds brackets around ON() #4266 - minor fix to appendJoin code #9755 - generator showed php error if connection failed #9730 - quote identifiers on composite joins

* feature request #4266 - joins with multiple keys #2216 - JOIN ON conversion of Where condition into ON arguments - patch by David Sanders #---- add in docbook hooks to generator - as requested/coded by Vyacheslav Iutin
2006-12-15
1.8.5
1.8.5
stable
stable
PHP License
Minor Bugfix and Minor Feature addition release * #8876 - call free() after count - hopefully this will not break anything! * #8736 - auto_increment check for MDB2 backend * #8628 - tableInfo fix for MDB2 * #7792 - add integer[] and boolean[] support * #7702 - memory leaks on getLinks() , free() is called within getLinks(), - you still need to call free() after doing a getLink() - as I suspect automagically doing that would cause problems.. * #7409 - ibase support for filename based database names - not sure if this works, but will ask reporter to test it.. * #7353 - postgres incorrect testing of t/f for booleans * #7114 = generator of sequence keys and defaults using generator_no_ini * #3773 - change last_value to currval - need to confirm this is the correct fix. * #3152 - joinAdd requires join column to be in links.ini file

Feature Requests: * Feature Request #4266 - Allow joins with multiple keys

Minor Changes: * dont flush on debugging html output * links.ini code generation based on schema (mysql[i] only) - option:generate_links=true - thanks to Pacal Schoni * add warning about unknown types in generator. * only prefix database name, in joins when the two objects are of different databases * nicer error message for !isreadable - thx to Euan Maxwell * use class exists loader, so that relative test relative paths in tests work, (also means that autoload may work...) * remove pass by reference - why on earth that was there in the first place is totally beyond me... * give derivedHookFunctions the ability to use the original input data * add methods getClassNameFromTableName(), getFileNameFromTableName(), getMethodNameFromColumnName(), which allow you to set up your own mapping system by overriding them in your extended generator.. it however needs some support in dataobjects so currently flagged as EXPERIMENTAL
1.8.4
1.8.4
stable
stable
2006-03-06
PHP License
Minor Bugfix and Minor Feature addition release

Bugs ---- #7006 - fix links due to removal of databaseStructure call in 1.8.3, added call to connect(); #7012 - joinAdd fixed due to checking of wrong variable when buidling query on mysql.

Features -------- - Add support for defaults() generation in createTables/Generator, when using the flag generator_add_defaults = yes or generator_no_ini = yes a method defaults() is created in the table class, which contains the default values for the table generated from the database. Note: EXPERIMENTAL and only works with Mysql[i] at present.
1.8.3
1.8.3
stable
stable
2006-03-03
PHP License
Minor Bugfix and Minor Feature addition release

Bugs ---- - Remove Warning if class_prefix is not set, and allow it not to be set. - joinAdd() support for DB_DataObject::cast() objects (Daniel Braga) - MDB2 fixes for undefined constants (bate) - #6772 - Support for FLOAT4 type in postgres #6953 - Changed memory allocation of stored column values for SQL return when Fetching last item of an object. Fixing problem of missing columns on Last fetch from Join being broken when used with toArray(). #6928 - Defaulting to prefixing database name in joins for Mysql and Mysqli backends, so multiple joins across multiple databases work.

Features -------- - Add support for option 'generator_no_ini => true', which generates class files with schema defined inside the table(), keys() and sequenceKeys() (based on work and suggestions by Didler Galland and Justin Patrin) - SQL output for debugging now has line breaks to make it easier to read.

- SelectAs uses quote itendifiers for target format.
1.8.2
1.8.2
stable
stable
2004-01-21
PHP License
Minor Bugfix release

Bugs ---- #6543 - Generator broke due to MDB changes.
1.8.1
1.8.1
stable
stable
2006-01-20
PHP License
Bugs ---- #6153 - dont call autoload on PHP5 - kludgy wrapper around class_exists() #6458 - clear staticGet cache when calling free() #6442 - validation not working correctly on DB_DataObject_Cast Objects Changes/New Features -------------------- * fix warning if setFrom called with object.. * make createTables honour debug level in ini file. * Added support in generator, for MDB2 backend to generate the class files (bate)
1.8.0
1.8.0
stable
stable
2005-12-28
PHP License
Major Bug Fix & Feature release.

Bugs:

#4871 - remove warning when value is not found in table #4834 - case sensitive checks for db_dataobject_cast fail #4894 - Validate methods can return PEAR Errors, or even messages now.. - only true indicates success #4938 - support MONEY type for MSSQL #4968 - count() will not be affected by changing default db fetchmode #5036 - make sure DB is loaded before using it #5264 - add optional dep on MDB #5416 - use tablea AS tableb only for postgress/mysql - oracle doesnt need the AS bit - and I guess a few others too.. available and first fetch fails conditions #5614 - joinAdd check to see if object being joined is really a dataobject #5065 - count returns number cast to an integer (even though database may return a string) #5800 - generator will continue creating other tables if we find one that fails... #5881 - wrap conditions with extra brackets remaining checks in validate #5393 - flag up unique only keys as "U", rather than "K" (or "N" for native) to allow anything calling keys() to find more detailed information - should have no effect on the dataobject class, as only sequence keys looks for "K"

Feature Requests:

#5146 - option: generator_var_keyword, to specify if you want to use var or public

Other Changes

default behaviour.. so it shouldnt really have affected anyone.. amazed no one picked this up before.. * make WHERE stripping better = well spotted Justin * catch errors returned from nextID - like permission denied etc., add warnings in debug mode if we are using objects or arrays for some reason, fix error messages * correct the dependancy on packages * the dont die here causes a recursive error and segfaults everything if it doesnt return.. * use is_a, rather than PEAR, as one day we may remove that dep... * fix PHP4.4* issues with returning by reference.. * make debugging schema loading errors a bit easier * test for bug #5931 added to test 91 * update($dataobject), change check for changes to strict checking, so that 0001 -> 00001 works, along with many other situations.., remove extra ; from code * fix null detection on postgres, - patch by Alistair MacDonald * free result columns as well as results after fetching all rows.
1.7.15
1.7.15
stable
stable
2005-07-07
PHP License
Minor Bugfix release * fix bug #4760 - DB_DataObject_Cast blobs broke in last release
1.7.14
1.7.14
stable
stable
2004-06-25
PHP License
Bugfix release (Mostly) Special thanks to Dan Rossi for the MDB Backend work on this release.

Key changes: - SQLlite support for files. - MDB Backend support (experimental) use: db_driver = MDB as a config option. NOTE: the generator will probably not work.

- toArray() has an extra argument (bool)hideEmpty, which prevents it returning key/value pair when the value is empty - DB_DataObject_Cast object was redesigned to enable better quoting of blobs - PostgresSQL schema for tablenames can be removed with the generator_strip_schema = 1 - Fetch return value and object->N are now "true", rather than 1 when numRows is not supported, (also document it on find())

Bugs Fixed. * fix bug #4672 - query(COMMIT) relays return value from DB->commit() * fix bug #4535 - fix update/select etc. for postgres with boolean values. * fix bug #4601 - wrong method used to test if file for sqlite * fix bug #4193 - sqlite names causing invalid .ini files * fix bug #4518 - escape and transactions fixed for MDB backend * fix bug #4431 - add hideEmpty to toArray() - not sure if I really like this.. - adding args to methods, the root of all evil ;) * fix bug #4383 - generator getListOf() call now expects pear errors * fix bug #4235 #4203 - schema mess with postgres. generator_strip_schema=1 will strip the schema part from the name of the table. * fix bug #4168 - if connection test is sucessfull, dont try and connect.. (performance improvement) * fix bug #4040 - prevent toArray from calling getLink and getLinks * fix bug #4019 - createTables uses sets up options for DB compatibility mode * fix bug #4000 - better checking for php 4.3.10 * fix bug #3944 - support for informix autoincrements * fix bug #4182 - better string and blob support on mysql in cast * fix bug #4135 - boolean values borked in condition building..
1.7.13
1.7.13
stable
stable
2005-03-24
PHP License
Minor Bugfix release #3943 - postgres booleans broke again due to last fix for mysqli.
1.7.12
1.7.12
stable
stable
2004-03-23
PHP License
Daily Bugfix release. ;) #3898 - mysqli quote bug fixed. (Greg Beaver) #------ provisional support for mysql blobs in Cast object (Antony Jankelowitz)
1.7.11
1.7.11
stable
stable
2005-03-22
PHP License
Minor Bugfix release. #3898 - fix count , which got broken by previous distinct argument changes #------ support $x IS NOT NULL using $obj->value = DB_DataObject_Cast::sql("NOT NULL");
1.7.10
1.7.10
stable
stable
2005-03-16
PHP License
Minor Bugfix release. #3829 - joinAdd fix for database prefixing (yet again)
1.7.9
1.7.9
stable
stable
2005-03-12
PHP License
Minor Bugfix release. #3764 - toValue(), and hence toArray() cast booleans to true|false. (previous fix was buggy)
1.7.8
1.7.8
stable
stable
2005-03-12
PHP License
Minor Bugfix release. #3764 - toValue(), and hence toArray() cast booleans to true|false. #3763 - createTables.php defines NO_OVERLOAD to prevent warnings on PHP4.3.10.

#3768 - Hopefully last fix to joinAdd() / database prefixing and quoteIdentifiers #3761 - Fixed DB_DataObject::datetime() bad code. #3783 - count('distinct') builds the query distinct [primary_key], should help in some situations using joinAdd + group By etc.
1.7.7
1.7.7
stable
stable
2005-03-07
PHP License
Minor bug fix release - join add with table fixes broke for mysql with last release Bug Fixes: #---- - Joins incorrectly prefect database name for mysql/mysqli (Thanks to Mark Mitchenall for spotting this) #---- used wrong variable for checking prefixes. (Stephane Gully)
1.7.6
1.7.6
stable
stable
2005-03-05
PHP License
Nothing like a big release to create bugs..

Note: the last release also included method creation for setters and getters, which got missed out from the changelog. Bug Fixes: #3708 - Generator did not clear last files contents when generating new files. #3706 - Joins broke on everything except mysql (database prefix now only added to mysql)
1.7.5
1.7.5
stable
stable
2005-03-02
PHP License
A few releases where skipped, this should be the amalgamated upgrade!

Note: php4.3.10 will exit with an error if you dont define NO_OVERLOAD, rather than segfaulting..

Generator is buggy with 5.0.3 - upgrade DB or PHP..

Bug Fixes: #3584 - Cast now supports time and datetime, (theiron) #3645 - PHP4 clone FC hack now calls $obj->__clone() in a similar way to PHP5 #2928 - lastError contains the last error when query bugs out now. #2674 - column names null / true /false etc. now halt createtables #2778 - more informative warning shown when postgres bug is found. #---- - experimental multidatabase join support #2739 - sleep is relayed into __call - bug in PHP5 #2565 - oci8 NUMBER type recoginzed #---- - new option generate_add_validate_stubs = 1, creates validate stubs. #---- - more comprehensive limit support (Lutz Thomas) #---- - allow access to columns starting with _ eg. set_xxx() & get_xxx() (Sandro) #---- - Generator write E_STRICT code for PHP5 now #2441 - Debugging code removed.

#---- - multiple HAVING calls now supported. #2468 - remove warning hider. #2318 - update($do) when no changes detected returns true. #2319 - joinAdd does not use AS when table and target have same name. #---- - Dia diagram generation tools available in CVS (build diagrams from dataobjects)

#2267 - additional debugging information available at connect time
1.7.2
1.7.2
stable
stable
2004-08-28
PHP License
Minor bug fix / Minor feature addition release

Bug Fixes: #1835 - more fixes to ensure that joinAdd works correctly. #2106 - Update with old object having no changes does not raise an error #---- - fixed problem of call() code producing parse error on PHP5.0.1 #2205 - fixed case sensitivity of PHP5 call() #---- - fixed undefined index in delete after a fetch()

Features Added: #2086 - Support for buliding dataobjects for Views (use option build_view=1) #2240 - factory() called on a dataobject returns a new instance of that object.
1.7.1
1.7.1
stable
stable
2004-08-09
PHP License
Minor bug fix release

Bug Fixes: #2088 - class_prefix may be left out. #------ php4.2 compatibility should work as advertised in last realease #------ Generator didnt have DB loaded due to lazy load changes.
1.7.0
1.7.0
stable
stable
2004-06-03
PHP License
Major bug fix release, Minor features added.

Bug Fixes: #1559 - __FUNCTION__ remove, so dependancy on php 4.2 may still be valid. #1595 - regex include/exclude working correctly (Thanks to Stephane Gully) #1664 - configuration line links_{databasename} now available #1726 - enable orderby and limit can be used with delete() #1697 - prevent generator from adding an extra line created after definition. #1704 - update only adds null when the column is not marked 'not null' #1778 - toArray() returns a merge of defined table and actual results #1828 - Generator will die, if tableinfo is not supported. #1833 - links() now returns an empty array (no links) or null (no links.ini) so it can be used generically with : $ar = (array) $do->links(); #1835 - getLinks, getLink etc. now use ->links(), so you can define your own links() to return table links, rather than use links.ini files. #1923 - removed all @ silencers, and replace with empty/isset. #1935 - selectAs() - removed double quoteIdentifiers #2068 - workaround for DB bug, postgres nextval() being rawurlencoded #1980 - logic error when using quoteIdentifiers

Changes: * DebugLevel(1) now displays native errors from database when queries fail. * Result Field names now stored seperately from Result Object * free() method added, to clean up memory instantly, if you are doing alot of queries. = Cleans Result Fields, Result Object, NumRows returned in Connection object. * include path is used to do file hunting if factory fails to find file. * DB is lazy loaded on connection.b
1.6.1
1.6.1
stable
stable
2004-06-03
PHP License
Minor Bug Fix

* fixed count() breaks when countWhat used.
1.6.0
1.6.0
stable
stable
2004-04-24
PHP License
Minor Feature Release and many bug fixes..

* DB_DataObject_Error added to enable testing for dataobject errors * Date fixes - needs latest date package. * Generator fails with clear message if backend doesnt support tableInfo * added cidr, inet, macaddr for postgres * new options to filter generation of classes generator_include_regex = /foo_.*/i generator_exclude_regex = /tmp_.*/i * result column list is now stored for all queries (in the result object) so toArray() allways relates to the query. * php version correted in package file. * getLinks called before other database call fixed. * Updating without changing things, no longer raises a pear error, it just returns 0 (eg. no rows affected) * now Depends on 1.4 DB - escapeSimple is now used * extra option to disable assumtions to use pear db's nextID dont_use_pear_sequences = true * DebugLevel($val) if $val is not an integer - it is assumed to be a callback. * fixed clearing of data results after last fetch (reduces memory consumption when doing many queries) * strtolower any class name tests. * count accepts 1 or 2 arguments $countWhat or $whereAddonly, or $countWhat and $whereAddonly eg. $countWhat = "distinct id" eg. $countWhat = true (means $whereAdd = true) * selectAdd() returns existing value, so you can modify it. * most debugging & raiseError calls are dynamic, so you can overload them. * numbers allowed in tablenames. * ini filename uses database_{projectname} => {projectname}.ini so database names are portable, and multiple projects are theoretically feasible. * __clone is replaced with clone() for PHP5 compaitiblity. * use PEAR::getStaticProperty("DB","options") for oracle portablity settings. * null checked against not null spec.

And probably a few more - as it's been quite a while since the last release..
1.5.3
1.5.3
stable
stable
2004-01-29
PHP License
Bug fix release.

Changes: - fixed toValue() ** previously did not work correclty.. ** getXXX($format) correctly relays into toValue - see strftime / Data::format or sprintf for formats, depending on column type.

Fixes * fix bug #630 - correct handling of YEAR (it's an int) * fix bug #630 - mysql timestamps are ingored for updated and insert (use query() if you want to change them manually. * fix bug #620 - limit accepts floats and doubles, as long as they are really integers..
1.5.2
1.5.2
stable
stable
2004-01-24
PHP License
Bug fix release.

Changes: - removed automatic strtotime() in setters and setFrom ** this is closer to the previous behaviour (it caused too many problems with strange dates ** if you set a date/time column with a number, it assumes it is a unixtimestamp -- enables you to write setters like function setSome_Date($value) { $this->fromValue('some_date',strtotime($value)); }

Fixes * $DB_DataObject->getDatabaseConnection() will return a pear error if dont_die is set, so it can be used to test connections. * note changed on databaseStructure, it can be called statically and dynamically. * fix bug #612 databaseStructure('databasename') will output the ini file structure array , with __keys * fix bug #611 corrected comment about NO_OVERLOAD * fix bug #603 to prevent clearing of queries after fetch, use the option keep_query_after_fetch = 1 * fix bug #359 (again) - _link_loaded array should only contain links that where sucessfully loaded
1.5.1
1.5.1
stable
stable
2004-01-22
PHP License
Bug fix release. Fixes * fixed fromValue had problems with null and DataOBject_Cast objects * NOT NULL checking enabled in fromValue (eg. setters) * fix bug #605 - ability to specify sequence names option sequence_{tablename} = {column} // default {tablename}_seq option sequence_{tablename} = {column}:{sequence_name} * Dependancy on Date added. (it is used by the setter/getters)
1.5
1.5
stable
stable
2004-01-20
PHP License
New Features / Fixes * proxy and auto schema building - you can use dataobjects wihout running create tables. - schema is created on the fly if no schema file exists - using config option proxy=full, a class is generated on the fly to represent the tables. * toValue and fromValue added as getter and setter providers - they include date formating tools - eg. $do->getBirthDay('%d/%m/%Y') will work with overload and PEAR::Date to provide formated dates. (works with date/time and datetime) - set*() will also call strtotime and PEAR::Date to try and read dates.\ setFrom will relay into fromValue() - hence auto fixing date entries * make native key recognision a little better - changes ini file format (key=N|K) - native or key. - BC protected... - ignores it when it finds a number.. (Fixes bug #532) * allow multiple updates on the same object - without adding lots of id=.... on the end.. * transactions support works transparently by sending $do->query('BEGIN'), $do->query('COMMIT'),$do->query('ROLLBACK') will automatically relay into the DB methods. * re-add support for sequence_{tablename} - prefered method is still overriding sequenceKey, and returning correct values.

Bug Fixes * fix bug #595 - replace non letters in class names with underscore.. * fix bug #532 - better recoginsion of sequence keys * fix bug #528/#476 - typo fix (E_NOTICE error on $valu) * fix bug #473 - query can return a DB_Error * fix bug #501 - autoload/factory now uses full path (not require path) * fix bug #507 - sequences broken
1.4
1.4
stable
stable
2003-12-20
PHP License
1.3
1.3
stable
stable
2003-11-14
PHP License
New Features - Inserts and updates do not use keys in the data creation part of the query (Markus Wolff)

- MsSQL native get_last_insert ID using SELECT @@IDENTITY ** you may want to consider using this with transactions eg. $dataobject->query('BEGIN') and $dataobject->query('COMMIT') to ensure thread safety. (Markus Wolff)

- DB_DataObject_Cast - a experimental generic casting feature for assigning variables * Common usages: // blobs $dataObject->someblobfield = DB_DataObject_Cast::blob(file_get_contents('xxx.jpg')); $dataObject->someblobfield = DB_DataObject_Cast::string('xxxxx');

// dates? $dataObject->at_date = DB_DataObject_Cast::date('12/12/2000'); //Human $dataObject->at_date = DB_DataObject_Cast::date('2000-12-12'); //ISO $dataObject->at_date = DB_DataObject_Cast::date(2000,12,12); //YYYY,dd,mm $d2 = DB_DataObject_Cast::date(); // today! // some addition $dataObject->expires = DB_DataObject_Cast::date($d1->year, $d1->month+30, $d1->day+30);

// raw sql???? $dataObject->maxids = DB_DataObject_Cast::sql('max(id) > 12'); $dataObject->emptyfield = DB_DataObject_Cast::sql('NULL');

You can extend this object to provide your own datatypes..

- PHP5 Compatibility Return values should work with PHP5beta2 Overload (__call) should work with PHP5beta2

- table() and keys() Allow setting of data with a value (so you can use dataobjects without extended instances.)

- factory/ getLinks and autoloading Will use the full path location in config to check if the file exists, after that it is included without warnings turned off.. (autoloading check to see if class exists first - should be faster)

Fixes: - Validate is an optional dependency (Arnaud Limbourg) - Bug #228, BOOL type on postgresql correctly quoted. - Bug #133, No error is raised when calling fetch with no data returned, just produces a debug warning now - Bug #172,Turning of Overload If you define DB_DATAOBJECT_NO_OVERLOAD to any value, then dataobjects will not be overloaded, This is usefull when working with ZendOptimizer, that may segfault with certain optimization levels
1.2
1.2
stable
stable
2003-08-07
PHP License
New Features: - A Number of the private methods have been made Public, changes: - _get_table() = table() - _get_keys() = keys() additions - tableName() = returns or assign the table name - database() = returns or assign the database name changes by Markus Wolff POSSIBLE BC IMPLICATIONS: If you define _get_table or _get_keys manually (rather than using the ini file) you should rename your methods table() and keys() Fixes: - Generator is now more tollerant of editors that alter the spaces before the autocode markers ### (Andreas Ljunggren)
1.1
1.1
stable
stable
2003-08-07
PHP License
Bug Fixes - limit argument testing now accepts "10" (a string with an integer in it, as a valid argument) (Demian Turner) New Features - JoinAdd has additional Argument $joinCol, so you can specify multiple targets links of the same table, eg. user->friend, user->parent both connect to the user table.. (Andy Crain)
1.0.2
1.0.2
stable
stable
2003-07-31
PHP License
Minor Bugfix Release - Fix static Get call, case sensitivity properly.
1.0.1
1.0.1
stable
stable
2003-07-18
PHP License
Minor Bugfix Release - Fix Select defaults back to * after an fetch - Fix Update with NULL values
1.0
1.0
stable
stable
2003-07-16
PHP License
- Gold 1.0 Release.. - final stable release in this series. Future versions (eg. 1.1.*(dev)->1.2.*(release)) series will be generally API compatible, however is likely to use MDB rather than DB. - fix bug #23983 - argument checking on whereAdd, orderBy, limit and a few others (Mike Carter) - fix bug with cache clearing not working with staticGet and update/insert - null comparison for $object->var = 'null' will generate IS NULL query - null insert/update works when using 'null' as a value. - getLinks returns true on success - getLinks now has a formatter eg. '_%s' is default to allow user to define the format of variables to assign child objects to. - generator uses UNIQUE only if no primary/autoincrement type field is found. - added support for $object->having('sum(value) > 10'); - fetch will remove some query lines (so if you want to see how the query was built you will have to print_r() the object after find(), and before fetch(), or just use debugLevel(1) - overload calls from setFrom and toArray do method checks, as overload is still proving to be a little unstable especially with Zend Encoder. (Note: if DataObjects causes crashes , remove the overload code at the bottom of DataObjects.php)
0.19
0.19
stable
stable
2003-05-22
PHP License
- fix bug #23712 - deleting (and probably updating as well) an object while being fetched. (Michael McCarthy for spotting this) - fix generator overwriting code when file was edited in a Windows editor (Robert Janeczek) - validation will not produce errors on empty numeric data by default. - overload extension enabled to relay setFrom and toArray calls to get*, set* methods, which are predefined as getXXX = returns $object->XXX setXXX($V) = returns true (or an error string if you create your own) (only affects php-4.3.2RC2 or later..) - selectAs($dataobject,'prefix_%s') to help control the way join queries return their data * doing selectAs() - clears the select and sets it to table.id as id ... etc. - joinAdd has 2 extra optional arguments $dataObject->joinAdd($otherDataObject, $joinType, $joinAs) existing behaviour (INNER Joins) is default (eg. no value) $joinType can be: INNER,LEFT,RIGHT = eg. INNER JOIN ... etc. '' = just added with a , and the link conditions are added with a WHERE statement. $joinAs can be used to name the table differently in the join eg. SELECT .. FROM person INNER JOIN address as homeaddress ...... - setFrom has an extra optional parameter for formating: eg. $object->setFrom($_POST,'prefix_%s') would map prefix_name to $object->name the default is '%s' which is the same as the previous behaviour - added option dont_die (default no) to ini file default (no) means that DataObjects will emit a PEAR_ERROR_DIE on configuration and programming errors true or 1 means that you can write a PEAR::error handler to catch the errors and display a nice it's not working message
0.18
0.18
stable
stable
2003-05-17
PHP License
- add table prefix to autobuilt queries (assist in ambigous querys for joins) (Daniel Von Fange) - change update and delete to return the number of rows affected or false on failure - various code tidy ups - standards etc. (Arnaud Limbourg) - fix generator for postgres and mdb - use unique keys and look for 'nextval' as keys. - fix no key insert bug (G Moxley Kempster) - fix empty table bug in generator (Robert Janeczek) - staticAutoloadTable(), now handles parse errors in included files alot cleaner - added dependancies on PHP4.3, DB 1.3 and Validate (although Validate is optional) - added table prefix to count query (Richard Wallace)
0.17
0.17
stable
stable
2003-03-12
PHP License
- Usual post feature bug fix release - fix loading of links.ini for joinAdd, getLinks etc. (Geoff Hopson)
0.16
0.16
stable
stable
2003-03-06
PHP License
- replaced config storage - should improve performance - removed production option (not required due to improved config storage) - bugfix : added checks for is_array on ignore_sequence_keys (Hermen Heinen) - add toArray($format) which supports sprintf to enable easy integration with Quickforms etc. (Demian Turner) - add optional dataobject as variable to update(), so you can update will only create an update based on what has changed. (Geoff Hopson) - add join condition to count() (Daniel Von Fange) - modify limit() to work with postgresql and make it emit a fatal error if you try this on databases that do not directly support limit queries. (Geoff Hopson) * I'm open on better ideas for this - probably wrapping the find() select call
0.15
0.15
stable
stable
2003-02-13
PHP License
- modified find(true), so that it calls fetch rather than fetchrow so that overriding fetch will affect get() calls. (probably depreciates fetchrow now .. shout if anyone is using it) - added escape method as a quasi quote wrapper into pear::DB - useful for building your own queries - eg. like requests.. (does not add quotes) - fixed bug with delete not using primary key if it was set. (Ian Eure)
0.14
0.14
stable
stable
2003-02-06
PHP License
- added get affected rows to update/insert/delete they will return false if no data is affected and set the Objects lastError value. Note: databases that do not support affectedRows(), will always return false.
0.13
0.13
stable
stable
2003-01-23
PHP License
- bug fix release - debug_ignore_updates worked in reverse.. (Alexander Mazurov)
0.12
0.12
stable
stable
2003-01-22
PHP License
- Usual post release bug fix. - fixes *.links.ini incorrectly using *.links (Damian Turner) - Adds the ability to get PEAR Connection and result objects getDatabaseConnection() and getDatabaseResult() (jason rust)
0.11
0.11
stable
stable
2003-01-21
PHP License
- changed connecition and result caching to use global private variable, rather than getStaticProperty - results objects are not stored on insert/update/delete (speed increase on large inserts can be as much as 10x faster) - bug fix - Checks that primary keys are integers (Anthony Juou) - typo on No data returned warning - unit tests in CVS - new configuration option for whether to use insert id's and sequences. - Generator no creates boolean bit (mitchell perilstein)
0.10
0.10
stable
stable
2002-12-09
PHP License
- bug fix - Generator incorrectly set _database, causing generation of database.ini files to fail - change addslashes to PEAR::DB::quote() - generator now only replaces DB_DataObjects with extends variable if set, you can use generator_rewrite_class to set what is a valid replacement.
0.9
0.9
stable
stable
2002-12-06
PHP License
- bug fix release - dsn was not set correctly
0.8
0.8
stable
stable
2002-09-21
PHP License
- changed to stable status as it appears to be pretty stable now. - update and insert now return FALSE on error conditions (Peter Gebauer) which can be checked using === FALSE, and the error obtained using $object->_lastError - delete will only use primary keys if they are set, otherwise it will use all object variables to build the condition. (Daniel Ferreira) - Added derivedHookFunctions(), and derivedHookVar() to enable extensions to generator to make user defined methods. (Michael Lund Rasmussen) - support for INT4, BPCHAR, TIMESTAMPTZ and postres Primary keys (Xavier) - better PEAR CS complience (tabs and TRUE -> true), removed short open tags in generator (Thomas Volkmar Worm) - experimental addJoin method (Stijn de Reede) - Allow active options array (eg. dynamic changing of database config) (Sergey Lipnevich)
0.6
0.6
beta
beta
2002-09-10
PHP License
- bug fix release on insert (broke due to compatibility fixes)
0.5
0.5
beta
beta
2002-09-07
PHP License
- fixed database.links.ini file loading in wrong location (Jens Fischer) - fixed type on extends (Jens Fischer) - added __clone() support to pre- php5 classes - added multiple linked table support
0.4
0.4
beta
beta
2002-08-21
PHP License
- Bug fix release - createTables used wrong argv
0.3
0.3
beta
beta
2002-08-16
PHP License
- Fixed Globals requirement in createTables,
0.2
0.2
beta
beta
2002-07-12
PHP License
Removed list method, First upload as pear package. - Documentation now in PEAR Manual
0.1
0.1
beta
beta
2002-06-25
PHP License
PEARified