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

File: DataObject.php

Source Location: /DB_DataObject-1.7.13/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

Includes:

require_once('PEAR.php') [line 94]
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 107]

DB_DATAOBJECT_BLOB = 64

[ Top ]



DB_DATAOBJECT_BOOL [line 105]

DB_DATAOBJECT_BOOL = 16

[ Top ]



DB_DATAOBJECT_DATE [line 103]

DB_DATAOBJECT_DATE = 4

[ Top ]



DB_DATAOBJECT_ERROR_INVALIDARGS [line 125]

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 127]

DB_DATAOBJECT_ERROR_INVALIDCONFIG = -3

[ Top ]



DB_DATAOBJECT_ERROR_INVALID_CALL [line 129]

DB_DATAOBJECT_ERROR_INVALID_CALL = -7

[ Top ]



DB_DATAOBJECT_ERROR_NOCLASS [line 128]

DB_DATAOBJECT_ERROR_NOCLASS = -4

[ Top ]



DB_DATAOBJECT_ERROR_NODATA [line 126]

DB_DATAOBJECT_ERROR_NODATA = -2

[ Top ]



DB_DATAOBJECT_INT [line 100]

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 111]

DB_DATAOBJECT_MYSQLTIMESTAMP = 256

[ Top ]



DB_DATAOBJECT_NOTNULL [line 110]

DB_DATAOBJECT_NOTNULL = 128

[ Top ]



DB_DATAOBJECT_STR [line 101]

DB_DATAOBJECT_STR = 2

[ Top ]



DB_DATAOBJECT_TIME [line 104]

DB_DATAOBJECT_TIME = 8

[ Top ]



DB_DATAOBJECT_TXT [line 106]

DB_DATAOBJECT_TXT = 32

[ Top ]



DB_DATAOBJECT_WHEREADD_ONLY [line 135]

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 Mon, 11 Mar 2019 14:30:44 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.