Login   Register  
PHP Classes

File: Test_Light_Table.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Fabio Xavier de Lima  >  Light Table  >  Test_Light_Table.php  >  Download  
File: Test_Light_Table.php
Role: Example script
Content type: text/plain
Description: Class of example, shows how to use.
Class: Light Table
Execute SQL database queries from parameter lists
Author: By
Last change: correct role
Date: 6 years ago
Size: 1,652 bytes


Class file image Download
 * @author Fabio Xavier de Lima
 * Creation Date: 02/07/2008
 * Last Modfied: 02/07/2008

require_once 'Db_Light_Table.php';
MyTestTable extends Tabela {
$name 'USU_ONL';
$PrimaryKey 'myCod';
$myCod null;
$myName null;
$myDate null;
/*    The lines below are not part of the class.
    They are only to test and demonstrate how to use the object.
//    Create an instance of the object
$UserOnLine = new MyTestTable();
//    Set property
$UserOnLine->myName "Fabio";
//    Using the select method
$records $UserOnLine->select();
//    Result of selection
print '<br><hr>';
$dt = new Zend_Date();
//    setting properties of the object
$UserOnLine->myCod 10200;
$UserOnLine->myName 'Fabio Lima';
$UserOnLine->myDate $dt->get('dd/MM/yy');
//    Includes a new record in the table, using the values informed above..
print "<br>";
'Registros incluídos:' $UserOnLine->insert();
//    Deletes records in the table, using the values informed above.
print "<br>";
'records erased:' $UserOnLine->delete();
//    Create a second object, a past record.
//    In this case the object is created with their properties already loaded.
$UserOnLine2 = new MyTestTable($records[0]);
'<br> field1: '.$UserOnLine2->myCod;
'<br> field2: '.$UserOnLine2->myName;
'<br> field3: '.$UserOnLine2->myDate;