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

Class: Record

Source Location: /record.php

Class Overview


Record


Author(s):

Version:

  • 0.1.2

Variables

Methods



Class Details

[line 45]
Record

an item in a database table.

Usage:

  1.  // INSERT
  2.   $User $db->get_record'people' );
  3.  $User->save();
  4.  // UPDATE
  5.   $User $db->get_record'people'$req->userid );
  6.  $User->set_value'first_name'$req->first_name );
  7.  // DELETE
  8.   $User $db->get_record'people'$req->userid );
  9.  $db->delete_record$User );
  10.  // SELECT ONE
  11.   $User $db->get_record'people'$req->userid );
  12.  print "Hello$User->first_name!";
  13.  // SELECT MULTIPLE
  14.   $people $db->get_recordset"SELECT * FROM people WHERE disk_usage > 1000" );

More info... http://dbscript.net/record




Tags:

version:  0.1.2
access:  public
author:  Brian Hendrickson <brian@dbscript.net>


[ Top ]


Class Variables

$attributes =

[line 51]

attribute names and data from the database field


Type:   string[]


[ Top ]

$children =

[line 81]

list of related records returned by query


Type:   string[]


[ Top ]

$exists =

[line 111]

true if the record exists in the database


Type:   string


[ Top ]

$func_args =

[line 69]

arguments from Record object instantiation


Type:   string[]


[ Top ]

$modified_fields =

[line 57]

list of changed fields since last save_changes


Type:   string[]


[ Top ]

$primary_key =

[line 63]

primary key field


Type:   string


[ Top ]

$relationships =

[line 99]

true if this record is an unsaved skeleton record


Type:   string[]


[ Top ]

$select =

[line 75]

fields to SELECT if not *


Type:   string[]


[ Top ]

$selecttext =

[line 87]

sql query used to fetch this record


Type:   string


[ Top ]

$skeleton =

[line 93]

true if this is an unsaved skeleton record


Type:   boolean


[ Top ]

$table =

[line 105]

name of database table


Type:   string


[ Top ]



Class Methods


constructor Record [line 122]

Record Record( string $table, &$db)

Record

initialize a new record data object




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $table   table
   &$db  

[ Top ]

method belongs_to [line 344]

void belongs_to( string $relstring)

Belongs To

set a 'child-one' relationship




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $relstring   relstring

[ Top ]

method ChildCount [line 316]

Record ChildCount( string $table)

Child Count

Count the number of related records from a specific table




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $table   table

[ Top ]

method field_names [line 187]

string[] field_names( )

Field Names

get a list of Record attributes




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


[ Top ]

method FirstChild [line 274]

Record FirstChild( [string $table = NULL])

First Child

get the first Record returned from a related table




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $table   table

[ Top ]

method has_and_belongs_to_many [line 331]

void has_and_belongs_to_many( string $relstring)

Has and Belongs To Many

set a 'child-many' relationship




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $relstring   relstring

[ Top ]

method has_many [line 357]

void has_many( string $relstring)

Has Many

set a 'parent-many' relationship




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $relstring   relstring

[ Top ]

method has_one [line 370]

void has_one( string $relstring)

Has One

set a 'parent-one' relationship




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $relstring   relstring

[ Top ]

method is_skeleton [line 382]

void is_skeleton( )

Is Skeleton

Set the skeleton flag on a record




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


[ Top ]

method NextChild [line 297]

Record NextChild( [string $table = NULL])

Next Child

Iterate to the next Record returned from a related table




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $table   table

[ Top ]

method save [line 253]

void save( )

Save

Save all attributes into the database




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


[ Top ]

method save_changes [line 237]

void save_changes( )

Save Changes

Save attributes changed via ->set_value( field, new_value )




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


[ Top ]

method set_value [line 208]

void set_value( string $field, string $value)

Set Value

change a Record attribute value, and register the change in the database




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $field   field_name
string   $value   value

[ Top ]

method validate_field [line 396]

void validate_field( string $field, string &$value)

Validate Field

Look for a callback function for this field




Tags:

access:  public
author:  Brian Hendrickson <brian@dbscript.net>


Parameters:

string   $field   field_name
string   &$value   value

[ Top ]


Documentation generated on Mon, 19 Feb 2007 10:25:01 -0800 by phpDocumentor 1.3.1