Source for file test_general.php

Documentation is available at test_general.php

  1. <?php
  2. /**
  3.  * Tests general class functions.
  4.  * This script is used during development of the class itself.
  5.  * @author Sascha 'SieGeL' Pfalz <php@saschapfalz.de>
  6.  * @package db_SQLite
  7.  * @subpackage Examples
  8.  * @version 0.20 (07-Aug-2010)
  9.  *  $Id: test_general.php,v 1.4 2010/08/07 17:47:05 siegel Exp $
  10.  * @license http://opensource.org/licenses/bsd-license.php BSD License
  11.  * @filesource
  12.  */
  13. /**
  14.  * Load in the general functions for all tests.
  15.  */
  16. require_once('functions.inc.php');
  17.  
  18. /** Define the name of the database to use for this example: */
  19. define('SQLITEDB_TESTDB'  '/tmp/test.dbf');
  20.  
  21. // Determine SAPI type
  22. $d WhichBR();
  23.  
  24. // Create new instance of class
  25. $db new db_SQLite();
  26.  
  27. // Before doing anything connect first!
  28. $db->Connect(SQLITEDB_TESTDB);
  29.  
  30. if($d['SAPI'!= 'cli')
  31.   {
  32.   echo('<pre>');
  33.   }
  34.  
  35. echo($d['LF'].'General Test for SQLite class'.$d['LF'].$d['LF']);
  36.  
  37. $rc $db->Query('SELECT COUNT(*) AS TANZ FROM sqlite_master');
  38.  
  39. printf("PHP Version / SAPI type.........: %s / %s%s",phpversion(),$d['SAPI'],$d['LF']);
  40. printf("SQLite class version............: %s%s",$db->GetClassVersion(),$d['LF']);
  41. printf("SQLite library version..........: %s%s",$db->Version(),$d['LF']);
  42. printf("Name and size of database file..: %s (%s bytes)%s",SQLITEDB_TESTDB,number_format(filesize(SQLITEDB_TESTDB)),$d['LF']);
  43. printf("Number of objects in database...: %s%s",$rc['TANZ'],$d['LF']);
  44.  
  45. // Always disconnect when you don't need the database anymore
  46. $db->Disconnect();
  47.  
  48. // Dump out all defined methods in the class:
  49.  
  50. $class_methods get_class_methods('db_SQLite');
  51. natcasesort ($class_methods);
  52.  
  53. printf("%sList of defined functions (%s) in SQLite class:%s%s",$d['LF'],count($class_methods),$d['LF'],$d['LF']);
  54. $cnt 1;
  55. foreach ($class_methods as $method_name)
  56.   {
  57.   printf("%02d. %s%s",$cnt,$method_name,$d['LF']);
  58.   $cnt++;
  59.   }
  60.  
  61. DBFooter($d['LF'],$db);
  62.  
  63. echo($d['LF']);
  64. exit;
  65. ?>

Documentation generated on Sat, 07 Aug 2010 20:01:06 +0200 by phpDocumentor 1.4.3