DB_DataObject
[ class tree: DB_DataObject ] [ index: DB_DataObject ] [ all elements ]

File: DataObject.php

Source Location: /DB_DataObject-1.11.2/DB/DataObject.php

Classes:

DB_DataObject_Overload
storage for connection and result objects, it is done this way so that print_r()'ing the is smaller, and it reduces the memory size of the object.
DB_DataObject
storage for connection and result objects, it is done this way so that print_r()'ing the is smaller, and it reduces the memory size of the object.

Page Details:

Object Based Database Query Builder and data store

For PHP versions 4,5 and 6

LICENSE: This source file is subject to version 3.01 of the PHP license that is available through the world-wide-web at the following URI: http://www.php.net/license/3_01.txt. If you did not receive a copy of the PHP License and are unable to obtain it through the web, please send a note to license@php.net so we can mail you a copy immediately.

Includes:

require_once('PEAR.php') [line 91]
The main "DB_DataObject" class is really a base class for your own tables classes

// Set up the class by creating an ini file (refer to the manual for more details [DB_DataObject] database = mysql:/username:password@host/database schema_location = /home/myapplication/database class_location = /home/myapplication/DBTables/ clase_prefix = DBTables_

//Start and initialize...................... - dont forget the & $config = parse_ini_file('example.ini',true); $options = &PEAR::getStaticProperty('DB_DataObject','options'); $options = $config['DB_DataObject'];

// example of a class (that does not use the 'auto generated tables data') class mytable extends DB_DataObject { // mandatory - set the table var $_database_dsn = "mysql://username:password@localhost/database"; var $__table = "mytable"; function table() { return array( 'id' => 1, // integer or number 'name' => 2, // string ); } function keys() { return array('id'); } }

// use in the application

Simple get one row

$instance = new mytable; $instance->get("id",12); echo $instance->somedata;

Get multiple rows

$instance = new mytable; $instance->whereAdd("ID > 12"); $instance->whereAdd("ID < 14"); $instance->find(); while ($instance->fetch()) { echo $instance->somedata; } Needed classes

  • we use getStaticProperty from PEAR pretty extensively (cant remove it ATM)


DB_DATAOBJECT_BLOB [line 115]

DB_DATAOBJECT_BLOB = 64

[ Top ]



DB_DATAOBJECT_BOOL [line 113]

DB_DATAOBJECT_BOOL = 16

[ Top ]



DB_DATAOBJECT_DATE [line 111]

DB_DATAOBJECT_DATE = 4

[ Top ]



DB_DATAOBJECT_ERROR_INVALIDARGS [line 133]

DB_DATAOBJECT_ERROR_INVALIDARGS = -1
Theses are the standard error codes, most methods will fail silently - and return false

to access the error message either use $table->_lastError or $last_error = PEAR::getStaticProperty('DB_DataObject','lastError'); the code is $last_error->code, and the message is $last_error->message (a standard PEAR error)


[ Top ]



DB_DATAOBJECT_ERROR_INVALIDCONFIG [line 135]

DB_DATAOBJECT_ERROR_INVALIDCONFIG = -3

[ Top ]



DB_DATAOBJECT_ERROR_INVALID_CALL [line 137]

DB_DATAOBJECT_ERROR_INVALID_CALL = -7

[ Top ]



DB_DATAOBJECT_ERROR_NOCLASS [line 136]

DB_DATAOBJECT_ERROR_NOCLASS = -4

[ Top ]



DB_DATAOBJECT_ERROR_NODATA [line 134]

DB_DATAOBJECT_ERROR_NODATA = -2

[ Top ]



DB_DATAOBJECT_FETCHMODE_ASSOC [line 98]

DB_DATAOBJECT_FETCHMODE_ASSOC = 2

[ Top ]



DB_DATAOBJECT_FETCHMODE_ORDERED [line 97]

DB_DATAOBJECT_FETCHMODE_ORDERED = 1
We are duping fetchmode constants to be compatible with

both DB and MDB2


[ Top ]



DB_DATAOBJECT_INT [line 108]

DB_DATAOBJECT_INT = 1
these are constants for the get_table array user to determine what type of escaping is required around the object vars.

[ Top ]



DB_DATAOBJECT_MYSQLTIMESTAMP [line 119]

DB_DATAOBJECT_MYSQLTIMESTAMP = 256

[ Top ]



DB_DATAOBJECT_NOTNULL [line 118]

DB_DATAOBJECT_NOTNULL = 128

[ Top ]



DB_DATAOBJECT_STR [line 109]

DB_DATAOBJECT_STR = 2

[ Top ]



DB_DATAOBJECT_TIME [line 112]

DB_DATAOBJECT_TIME = 8

[ Top ]



DB_DATAOBJECT_TXT [line 114]

DB_DATAOBJECT_TXT = 32

[ Top ]



DB_DATAOBJECT_WHEREADD_ONLY [line 143]

DB_DATAOBJECT_WHEREADD_ONLY = true
Used in methods like delete() and count() to specify that the method should build the condition only out of the whereAdd's and not the object parameters.

[ Top ]



Documentation generated on Fri, 05 Apr 2013 09:00:04 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.