[Cs-webapplibs-commits] SF.net SVN: cs-webapplibs:[193] trunk/0.4
Status: Beta
Brought to you by:
crazedsanity
From: <cra...@us...> - 2011-01-26 04:25:48
|
Revision: 193 http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=193&view=rev Author: crazedsanity Date: 2011-01-26 04:25:41 +0000 (Wed, 26 Jan 2011) Log Message: ----------- Drop Generic Data Linker code, since it was flawed and really isn't used. Modified Paths: -------------- trunk/0.4/setup/schema.mysql.sql trunk/0.4/setup/schema.pgsql.sql trunk/0.4/tests/testOfCSWebAppLibs.php Removed Paths: ------------- trunk/0.4/abstract/cs_gdlAttrib.abstract.class.php trunk/0.4/abstract/cs_gdlObject.abstract.class.php trunk/0.4/abstract/cs_gdlPath.abstract.class.php Deleted: trunk/0.4/abstract/cs_gdlAttrib.abstract.class.php =================================================================== --- trunk/0.4/abstract/cs_gdlAttrib.abstract.class.php 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/abstract/cs_gdlAttrib.abstract.class.php 2011-01-26 04:25:41 UTC (rev 193) @@ -1,89 +0,0 @@ -<?php -/* - * Created on Jan 29, 2009 - * - * FILE INFORMATION: - * - * $HeadURL$ - * $Id$ - * $LastChangedDate$ - * $LastChangedBy$ - * $LastChangedRevision$ - */ - -abstract class cs_gdlAttribAbstract extends cs_gdlPathAbstract { - - - const table='cswal_gdl_attribute_table'; - const tableSeq = 'cswal_gdl_attribute_table_attribute_id_seq'; - - - - //------------------------------------------------------------------------- - public function create_attrib($path, $data, $type=null) { - - $objectId = $this->get_object_id_from_path($path); - - $insertString = ""; - $attribs = array(); - if(is_array($data) && count($data)) { - foreach($data as $n=>$v) { - $n = $this->translate_attrib_name($n); - $attribs[$n] = $v; - } - } - elseif(!is_null($type)) { - $key = $this->translate_attrib_name($type); - $attribs = array($key => $data); - } - else { - throw new exception(__METHOD__ .": data was not array and no type set"); - } - - if(!is_array($attribs) || !count($attribs)) { - throw new exception(__METHOD__ .": failed to create an array of attributes... ". $this->gfObj->debug_print(func_get_args(),0)); - } - - $attribs['object_id'] = $objectId; - $insertString = $this->gfObj->string_from_array($attribs, 'insert'); - - - if(!strlen($insertString)) { - throw new exception(__METHOD__ .": invalid insert string (". $insertString .")"); - } - $sql = "INSERT INTO ". self::attrTable ." ". $insertString; - - try { - $retval = $this->db->run_insert($sql, self::attrTableSeq); - } - catch(exception $e) { - throw new exception(__METHOD__ .": failed to perform insert::: ". $e->getMessage() .' ---- '. $sql); - } - - return($retval); - }//end create_attrib() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function translate_attrib_name($name) { - $retval = null; - foreach($this->validTypes as $type) { - if(preg_match('/^'. $type .'/', $name)) { - $retval = 'a_'. $type; - break; - } - } - - if(is_null($retval) || !strlen($retval)) { - $this->gfObj->debug_print(__METHOD__ .": name was (". $name ."), retval=(". $retval .")",1); - throw new exception(__METHOD__ .": invalid attribute name (". $name .")"); - } - - return($retval); - }//end translate_attrib_name() - //------------------------------------------------------------------------- - -} -?> \ No newline at end of file Deleted: trunk/0.4/abstract/cs_gdlObject.abstract.class.php =================================================================== --- trunk/0.4/abstract/cs_gdlObject.abstract.class.php 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/abstract/cs_gdlObject.abstract.class.php 2011-01-26 04:25:41 UTC (rev 193) @@ -1,136 +0,0 @@ -<?php -/* - * Created on Jan 29, 2009 - * - * FILE INFORMATION: - * - * $HeadURL$ - * $Id$ - * $LastChangedDate$ - * $LastChangedBy$ - * $LastChangedRevision$ - */ - -abstract class cs_gdlObjectAbstract extends cs_webapplibsAbstract { - - - const table='cswal_gdl_object_table'; - const tableSeq = 'cswal_gdl_object_table_object_id_seq'; - - //------------------------------------------------------------------------- - public function get_object_id_from_path($path) { - $sql = "SELECT object_id FROM ". self::table ." WHERE object_path='". - $this->clean_path($path) ."'"; - - try { - $data = $this->db->run_query($sql); - - if(is_array($data) && count($data) == 1) { - $retval = $data['object_id']; - } - else { - throw new exception(__METHOD__ .": invalid data for path (". $this->clean_path($path) .")::: ". $this->gfObj->debug_var_dump($data,0)); - } - } - catch(exception $e) { - throw new exception(__METHOD__ .": error retrieving path::: ". $e->getMessage()); - } - - return($retval); - }//end get_object_id_from_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function create_object($name, $data=null, $type=null) { - $sql = "INSERT INTO ". self::table ." (object_name) VALUES ('". - $this->gfObj->cleanString($this->clean_path($name), 'sql_insert') ."')"; - try { - $retval = $this->db->run_insert($sql, self::tableSeq); - } - catch(exception $e) { - throw new exception(__METHOD__ .": failed to perform insert::: ". $e->getMessage()); - } - - if(!is_null($data)) { - throw new exception(__METHOD__ .": can't create data for objects yet"); - } - return($retval); - }//end create_object() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function build_object_id_list(array $objects) { - $this->gfObj->switch_force_sql_quotes(1); - $sql = "SELECT * FROM ". self::table ." WHERE object_name IN (". - $this->gfObj->string_from_array($objects, null, ',', 'sql') .")"; - $this->gfObj->switch_force_sql_quotes(0); - - $retval = array(); - try { - $retval = $this->db->run_query($sql, 'object_name', 'object_id'); - if(!is_array($retval)) { - $retval = array(); - } - } - catch(exception $e) { - //throw new exception(__METHOD__ .": failed to retrieve list"); - } - - return($retval); - }//end build_object_id_list() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function build_object_name_list(array $objectIds) { - $this->gfObj->switch_force_sql_quotes(1); -//string_from_array($array,$style=NULL,$separator=NULL, $cleanString=NULL, $removeEmptyVals=FALSE) - foreach($objectIds as $i=>$myId) { - if(!strlen($myId)) { - unset($objectIds[$i]); - } - } - $sql = "SELECT * FROM ". self::table ." WHERE object_id IN (". - $this->gfObj->string_from_array($objectIds, null, ',', 'sql',true) .")"; - $this->gfObj->switch_force_sql_quotes(0); - - try { - $retval = $this->db->run_query($sql, 'object_id', 'object_name'); - if(!is_array($retval)) { - $retval = array(); - } - } - catch(exception $e) { - throw new exception(__METHOD__ .": failed to retrieve list::: ". $e->getMessage()); - } - - return($retval); - }//end build_object_id_list() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function create_objects_enmasse(array $objectList) { - $retval = 0; - foreach($objectList as $name) { - try { - $this->create_object($name); - $retval++; - } - catch(exception $e) { - //nothing to see here, move along. - } - } - return($retval); - }//end create_objects_enmasse() - //------------------------------------------------------------------------- - - -} -?> Deleted: trunk/0.4/abstract/cs_gdlPath.abstract.class.php =================================================================== --- trunk/0.4/abstract/cs_gdlPath.abstract.class.php 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/abstract/cs_gdlPath.abstract.class.php 2011-01-26 04:25:41 UTC (rev 193) @@ -1,126 +0,0 @@ -<?php -/* - * Created on Jan 29, 2009 - * - * FILE INFORMATION: - * - * $HeadURL$ - * $Id$ - * $LastChangedDate$ - * $LastChangedBy$ - * $LastChangedRevision$ - */ - -abstract class cs_gdlPathAbstract extends cs_gdlObjectAbstract { - - - const table='cswal_gdl_path_table'; - const tableSeq = 'cswal_gdl_path_table_path_id_seq'; - - - - - - //------------------------------------------------------------------------- - public function create_path($path) { - $idList = $this->create_path_objects($path); - $pathIdList = $this->create_id_path($idList); - - if($this->get_path_from_idlist($pathIdList)) { - $retval = $pathIdList; - } - else { - - $sql = "INSERT INTO ". self::table ." (path_id_list) VALUES ('". $pathIdList ."')"; - - try { - $insertedId = $this->db->run_insert($sql, self::tableSeq); - $retval = $pathIdList; - } - catch(exception $e) { - throw new exception(__METHOD__ .": unable to create path::: ". $e->getMessage()); - } - } - - return($retval); - }//end create_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function clean_path($path, $appendBase=true) { - if(strlen($path)) { - if($appendBase === true && !is_null($this->basePath)) { - $path = $this->basePath .'/'. $path; - } - $newPath = preg_replace('/\/{2,}/', '/', $path); - - if(!strlen($newPath)) { - throw new exception(__METHOD__ .": new path is zero-length (". $newPath ."), old path=(". func_get_arg(0) .")"); - } - } - else { - throw new exception(__METHOD__ .": no valid path given (". $path .")"); - } - - return($newPath); - }//end clean_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function set_base_path($path) { - if(is_null($path) || !strlen($path)) { - $this->basePath = null; - } - else { - $this->basePath = $this->clean_path($path,false); - } - }//end set_base_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function explode_path($path, $appendBase=true) { - $path = $this->clean_path($path, $appendBase); - $path = preg_replace('/^\//', '', $path); - $path = preg_replace('/\/$/', '', $path); - - return(explode('/', $path)); - }//end explode_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function create_id_path(array $idList) { - $retval = ':'. $this->gfObj->string_from_array($idList, null, '::') .':'; - return($retval); - }//end create_id_path() - //------------------------------------------------------------------------- - - - - //------------------------------------------------------------------------- - public function get_path_from_idlist($idPath) { - - $idList = explode('::', preg_replace('/^:/', '', preg_replace('/:$/', '', $idPath))); - - $nameList = $this->build_object_name_list($idList); - - $retval = "/"; - foreach($nameList as $id=>$name) { - $retval = $this->gfObj->create_list($retval, $name, '/'); - } - - $retval = $this->clean_path($retval,false); - - return($retval); - }//end get_text_path_from_id_path() - //------------------------------------------------------------------------- - -} -?> \ No newline at end of file Modified: trunk/0.4/setup/schema.mysql.sql =================================================================== --- trunk/0.4/setup/schema.mysql.sql 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/setup/schema.mysql.sql 2011-01-26 04:25:41 UTC (rev 193) @@ -168,33 +168,6 @@ -- --- Table for cs_genericDataLinker{}. --- -CREATE TABLE `cswal_gdl_object_table` ( - `object_id` int(11) NOT NULL PRIMARY KEY auto_increment, - `object_name` text NOT NULL UNIQUE -) ENGINE=InnoDB; - - -CREATE TABLE `cswal_gdl_path_table` ( - `path_id` int(11) NOT NULL PRIMARY KEY auto_increment, - `path_id_list` text NOT NULL UNIQUE -) ENGINE=InnoDB; - --- --- Store attributes here. --- NOTE: fields prefixed with "a_" to avoid clashes with reserved words. --- -CREATE TABLE `cswal_gdl_attribute_table` ( - `attribute_id` serial NOT NULL PRIMARY KEY auto_increment, - `object_path` text NOT NULL, - `a_text` text DEFAULT NULL, - `a_int` integer DEFAULT NULL, - `a_dec` decimal(10,2) DEFAULT NULL, - `a_bool` boolean DEFAULT NULL -) ENGINE=InnoDB; - --- -- Constraints for dumped tables -- Modified: trunk/0.4/setup/schema.pgsql.sql =================================================================== --- trunk/0.4/setup/schema.pgsql.sql 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/setup/schema.pgsql.sql 2011-01-26 04:25:41 UTC (rev 193) @@ -119,30 +119,3 @@ session_data text ); - --- --- Table for cs_genericDataLinker{}. --- -CREATE TABLE cswal_gdl_object_table ( - object_id serial NOT NULL PRIMARY KEY, - object_name text NOT NULL UNIQUE -); - - -CREATE TABLE cswal_gdl_path_table ( - path_id serial NOT NULL PRIMARY KEY, - path_id_list text NOT NULL UNIQUE -); - --- --- Store attributes here. --- NOTE: fields prefixed with "a_" to avoid clashes with reserved words. --- -CREATE TABLE cswal_gdl_attribute_table ( - attribute_id serial NOT NULL PRIMARY KEY, - object_path text NOT NULL, - a_text text DEFAULT NULL, - a_int integer DEFAULT NULL, - a_dec decimal(10,2) DEFAULT NULL, - a_bool boolean DEFAULT NULL -); Modified: trunk/0.4/tests/testOfCSWebAppLibs.php =================================================================== --- trunk/0.4/tests/testOfCSWebAppLibs.php 2011-01-20 01:27:08 UTC (rev 192) +++ trunk/0.4/tests/testOfCSWebAppLibs.php 2011-01-26 04:25:41 UTC (rev 193) @@ -11,66 +11,40 @@ * $LastChangedRevision$ */ -class testOfCSWebAppLibs extends UnitTestCase { +class testOfCSWebAppLibs extends testDbAbstract { //-------------------------------------------------------------------------- function __construct() { $this->gfObj = new cs_globalFunctions; $this->gfObj->debugPrintOpt=1; - if(!defined('CS_UNITTEST')) { - throw new exception(__METHOD__ .": FATAL: constant 'CS_UNITTEST' not set, can't do testing safely"); - } }//end __construct() //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- - private function create_dbconn() { - $dbParams = array( - 'host' => constant('cs_webapplibs-DB_CONNECT_HOST'), - 'dbname' => constant('cs_webapplibs-DB_CONNECT_DBNAME'), - 'user' => constant('cs_webapplibs-DB_CONNECT_USER'), - 'password' => constant('cs_webapplibs-DB_CONNECT_PASSWORD'), - 'port' => constant('cs_webapplibs-DB_CONNECT_PORT') - ); - $db = new cs_phpDB(constant('DBTYPE')); - $db->connect($dbParams); - return($db); - }//end create_dbconn() + function setUp() { + $this->gfObj = new cs_globalFunctions; + $this->gfObj->debugPrintOpt=1; + parent::__construct('postgres','', 'localhost', '5432'); + $tok = new authTokenTester($this->db); + $tok->load_schema('pgsql', $this->db); + }//end setUp() //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- - private function remove_tables() { - $tableList = array( - 'cswal_auth_token_table', 'cswal_version_table', 'cswal_attribute_table', - 'cswal_category_table', 'cswal_class_table', 'cswal_event_table', - 'cswal_log_attribute_table', 'cswal_log_table', 'cswal_session_store_table', - 'cswal_gdl_object_table', 'cswal_gdl_path_table', 'cswal_gdl_attribute_table' - ); - - $db = $this->create_dbconn(); - foreach($tableList as $name) { - try { - $db->run_update("DROP TABLE ". $name ." CASCADE", true); - } - catch(exception $e) { - //force an error. - //$this->assertTrue(false, "Error while dropping (". $name .")::: ". $e->getMessage()); - } - } - }//end remove_tables() + public function tearDown() { + $this->destroy_db(); + } //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- function test_token_basics() { - $db = $this->create_dbconn(); - $this->remove_tables(); - $tok = new authTokenTester($db); + $tok = new authTokenTester($this->db); //Generic test to ensure we get the appropriate data back. { @@ -202,262 +176,6 @@ //-------------------------------------------------------------------------- - function test_genericDataLinker() { - - $x = new gdlTester($this->create_dbconn()); - - //test objects & paths first. - { - $myPath = '/character/sheet///Tetra Tealeaf'; - - $this->assertEqual(array('character', 'sheet', 'Tetra Tealeaf'), $x->explode_path($myPath)); - $x->set_base_path('/testing'); - $this->assertEqual('/testing/character/sheet/Tetra Tealeaf', $x->clean_path($myPath)); - $this->assertEqual(array('testing', 'character', 'sheet', 'Tetra Tealeaf'), $x->explode_path($myPath)); - $x->set_base_path(null); - $this->assertNotEqual(array('testing', 'character', 'sheet', 'Tetra Tealeaf'), $x->explode_path($myPath)); - $this->assertEqual(array('character', 'sheet', 'Tetra Tealeaf'), $x->explode_path($myPath)); - $this->assertEqual('/character/sheet/Tetra Tealeaf', $x->clean_path($myPath)); - - //now create some objects. - $pathBits = array(); - foreach($x->explode_path($myPath) as $name) { - $pathBits[$x->create_object($name)] = $name; - } - $newPathIdList = $x->create_path($myPath); - $myPathIdList = ':'. $this->gfObj->string_from_array(array_keys($pathBits), null, '::') .':'; - $this->assertEqual($newPathIdList, $myPathIdList); - - $newId = $x->create_object('testing'); - $t = array_keys($pathBits); - $t = array_pop($t); - $lastPathId = $t; - $this->assertEqual($newId, ($lastPathId +1)); - - $oldBits = $pathBits; - $pathBits = array(); - $pathBits[$newId] = 'testing'; - foreach($oldBits as $id=>$name) { - $pathBits[$id] = $name; - } - - $newPathIdList = $x->create_path('/testing/'. $myPath); - $myPathIdList = ':'. $this->gfObj->string_from_array(array_flip($pathBits), null, '::') .':'; - $this->assertEqual($newPathIdList, $myPathIdList); - - $this->assertEqual($newPathIdList, $x->create_path('/testing/'. $myPath)); - - $myRearrangedPath = array_reverse($pathBits, true); - $rPathIdList = ':'. $this->gfObj->string_from_array(array_flip($myRearrangedPath), null, '::') .':'; - $rPath = '/'. $this->gfObj->string_from_array($myRearrangedPath, null, '/'); - $this->assertEqual($x->create_path($rPath), $rPathIdList); - - $this->assertEqual($x->get_path_from_idlist($x->create_path($rPath)), $x->get_path_from_idlist($rPathIdList)); - $this->assertEqual($x->get_path_from_idlist($x->create_path($rPath)), $x->get_path_from_idlist($rPathIdList)); - $this->assertEqual($x->get_path_from_idlist($x->create_path($rPath)), $x->get_path_from_idlist($rPathIdList)); - $this->assertEqual($x->get_path_from_idlist($x->create_path($rPath)), $x->get_path_from_idlist($rPathIdList)); - } - - - //basic tests for building text-based paths vs. id-based paths. - { - $myPath = '/character/sheet/Tetra Tealeaf'; - - - $idList = $x->createPathObjects($myPath); - - $testObjectIdList = explode('/', preg_replace('/^\//', '', $myPath)); - $this->assertEqual($idList, $x->build_object_id_list($testObjectIdList)); - - $idList2 = $x->create_path($myPath); - $this->assertEqual($x->create_id_path(array_values($idList)), $idList2); - - $this->assertEqual($myPath, $x->get_path_from_idlist($x->create_id_path($idList))); - $this->gfObj->debug_var_dump($x->get_path_from_idlist($x->create_id_path($idList))); - - $this->gfObj->debug_var_dump($idList); - $this->gfObj->debug_var_dump($idList2); - - $this->assertEqual(':1::2::3:', $idList2); - $this->assertEqual($idList2, ':'. $this->gfObj->string_from_array($idList, null, '::') .':'); - - $this->assertEqual(':1::2::3:', $x->create_id_path($idList)); - - $this->assertEqual(':1:', $x->create_id_path(array(1))); - $this->assertEqual(':000010:', $x->create_id_path(array('000010'))); - - } - - - // now REALLY test paths. - { - $gdl = new gdlTester($this->create_dbconn()); - - $myBasePath = '/character/sheet/Xander Cage'; - $x->set_base_path($myBasePath); - - //now add something that should be BENEATH that path. - $idList = $x->create_path('attributes/str'); - - $this->gfObj->debug_var_dump($idList); - } - #*/ - - - - - /*/test some basics first. - $translations = array( - 'good' => array( - 'a_int' => array('int', 'integer', 'integraIsACarNotAnArgument'), - 'a_dec' => array('dec', 'decimal', 'decemberIsAMonth'), - 'a_bool' => array('bool', 'boolean', 'boolJustLooksLikeSomethingJiggly'), - 'a_text' => array('text', 'textual', 'textPaperJustLooksPink') - ), - 'bad' => array( - 'a_int' => array('num', 'a_int', 'nittedStuff'), - 'a_dec' => array('dce', 'a_dec', 'dceStuff'), - 'a_bool' => array('bolo', 'a_bool', 'boloMeansBeOnLookOut'), - 'a_text' => array('txt', 'a_text', 'txtIsABadAbbreviation') - ) - ); - - foreach($translations as $goodBad=>$matchesArray) { - foreach($matchesArray as $matchThis => $tryThese) { - foreach($tryThese as $k) { - try { - $this->assertEqual($matchThis, $x->translate_attrib_name($k)); - } - catch(exception $e) { - if($goodBad == 'good') { - $this->assertFalse(true, "test (". $k .") should have been good, but was bad::: ". $e->getMessage()); - } - } - } - } - } - $testData = array( - 'skills/Appraise/cc' => array('bool' => true), - 'skills/Appraise/mod' => array('int' => 3), - 'skills/Appraise/ab_mod' => array('int' => 3), - 'skills/Appraise/rank' => array('int' => 3), - 'skills/Appraise/misc_mod' => array('int' => 3), - 'skills/Appraise/notes' => array('text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit."), - 'skills/Appraise/test' => array( - 'text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'bool' => true, - 'dec' => 0.03 - ), - ); - - - $myBasePath = '/characters/Tetra Tealeaf/'; - $x->set_base_path($myBasePath); - foreach($testData as $path=>$subData) { - $this->assertEqual($myBasePath . $path, $x->clean_path($path)); - $this->assertTrue(is_numeric($x->create_object($path, $subData))); - } - - //get each individual item about the skill 'Appraise' individually. - $x->get_object_attribs('skills/Appraise/cc', 'bool'); - $x->get_object_attribs('skills/Appraise/mod', 'int'); - $x->get_object_attribs('skills/Appraise/ab_mod', 'int'); - $x->get_object_attribs('skills/Appraise/rank', 'int'); - $x->get_object_attribs('skills/Appraise/misc_mod', 'int'); - $x->get_object_attribs('skills/Appraise/notes', 'text'); - $x->get_object_attribs('skills/Appraise/test', array('text', 'bool', 'dec')); - $returnVal = array( - 'text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'bool' => true, - 'dec' => 0.03 - ); - - - //another way to retrieve it, without caring about what types are returned::: - $returnVal = $x->get_all_object_attribs('skills/Appraise', false); - $returnVal = array( - 'cc' => array( - 'test' => null, - 'bool' => true, - 'int' => null, - 'dec' => null - ), - 'mod' => array( - 'test' => null, - 'bool' => null, - 'int' => 10, - 'dec' => null - ), - 'ab_mod' => array( - 'test' => null, - 'bool' => null, - 'int' => 3, - 'dec' => null - ), - 'rank' => array( - 'test' => null, - 'bool' => null, - 'int' => 6, - 'dec' => null - ), - 'misc_mod' => array( - 'test' => null, - 'bool' => null, - 'int' => 1, - 'dec' => null - ), - 'notes' => array( - 'test' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'bool' => null, - 'int' => null, - 'dec' => null - ), - 'test' => array( - 'text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'bool' => true, - 'int' => null, - 'dec' => 0.03 - ) - ); - - //a better way to retrieve that data: - $returnVal = $x->get_all_object_attribs('skills/Appraise', false); - $returnVal = array( - 'cc' => true, - 'mod' => 10, - 'ab_mod' => 3, - 'rank' => 6, - 'misc_mod' => 1, - 'notes' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'test' => array( - 'text' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'bool' => true, - 'dec' => 0.03 - ) - ); - - //if we don't want all that junk in test, we can specify what to get for EACH one: - $types = array( - 'cc' => "bool", - 'test' => "dec" - ); - $returnVal = $x->get_all_object_attribs('skills/Appraise', false, $types); - $returnVal = array( - 'cc' => true, - 'mod' => 10, - 'ab_mod' => 3, - 'rank' => 6, - 'misc_mod' => 1, - 'notes' => "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", - 'test' => 0.03 - ); - #*/ - }//end test_genericDataLinker() - //-------------------------------------------------------------------------- - - - - //-------------------------------------------------------------------------- public function test_genericPermissions() { }//end test_genericPermissions() //-------------------------------------------------------------------------- @@ -494,16 +212,4 @@ } } -class gdlTester extends cs_genericDataLinker { - public $isTest = true; - - public function __construct($db) { - parent::__construct($db); - } - - public function createPathObjects($path) { - return($this->create_path_objects($path)); - } -} - ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |