

Public Member Functions | |
| toIterable (&$obj) | |
| Converts an unIterable Object to an Iterable array. | |
| toUnIterable ($arr) | |
| Converts an Iterable array to unIterable Object [returns the First row if multiple Rows Exist]. | |
| toObj ($arr) | |
| Converts an Array to stdClass Object. | |
| toArray ($obj) | |
| Converts an Object to an Array. | |
| dsnBuilder ($driver, $usr, $psw, $host, $db, $table, $port=null, $schema=null) | |
| Builds a DSN. | |
| dsnExplode ($dsn) | |
| Explode a DNS into an Array. | |
| createConn ($conAliasName, $drv, $database=null, $host=null, $user=null, $psw=null, $port=null) | |
| Create a Connection File (returns false if file already exists). | |
| deleteConn ($conAliasName) | |
| Delete a Connection File. | |
| overWriteConn ($conAliasName, $drv, $database=null, $host=null, $user=null, $psw=null, $port=null) | |
| Creates a Connection File (Over Writes if already exist). | |
| parseConn ($conAliasName) | |
| Parse the Connection file into an array. | |
Definition at line 60 of file zcde.php.
| zCDE::toIterable | ( | &$ | obj | ) |
| zCDE::toUnIterable | ( | $ | arr | ) |
Converts an Iterable array to unIterable Object [returns the First row if multiple Rows Exist].
| $arr | array |
Definition at line 77 of file zcde.php.
00077 { 00078 if(!is_array($arr))return $arr; 00079 if(count($arr)==0)return false; 00080 foreach($arr as $obj)return $obj; 00081 }
| zCDE::toObj | ( | $ | arr | ) |
Converts an Array to stdClass Object.
| $arr | array |
Definition at line 87 of file zcde.php.
References $val, and perror().
00087 { 00088 if(!is_array($arr))return $arr; 00089 $retObj = new stdClass(); 00090 foreach($arr as $key => $val){ 00091 if(ctype_digit($key)){ 00092 perror("<code>zigmoyd.cde</code><br />Your Array must not be numarically Indexed to get converted to an object"); 00093 }else{ 00094 $retObj->{$key} = zCDE::toObj($val); 00095 } 00096 } 00097 return $retObj; 00098 }

| zCDE::toArray | ( | $ | obj | ) |
| zCDE::dsnBuilder | ( | $ | driver, | |
| $ | usr, | |||
| $ | psw, | |||
| $ | host, | |||
| $ | db, | |||
| $ | table, | |||
| $ | port = null, |
|||
| $ | schema = null | |||
| ) |
Builds a DSN.
| $driver | string | |
| $usr | string | |
| $psw | string | |
| $host | string | |
| $db | string | |
| $table | string | |
| $port | string Optional | |
| $schema | string Optional |
Definition at line 125 of file zcde.php.
00125 { 00126 if($port)$portStr = ":$port"; 00127 else $portStr = ""; 00128 if($schema)$tableStr = "$schema.$table"; 00129 else $tableStr = $table; 00130 return "$driver://$usr:$psw@$host$portStr/$db/$tableStr"; 00131 }
| zCDE::dsnExplode | ( | $ | dsn | ) |
Explode a DNS into an Array.
| $dsn | string |
Definition at line 138 of file zcde.php.
References perror().
00138 { 00139 if(preg_match('~(?P<driver>\w+)://(?P<usr>\w+):(?P<psw>\w+)@(?P<host>\w+)(?::(?P<port>\d+))?/(?P<db>\w+)/(?P<schema>\w+)(?:\.(?P<table>\w+))?~', $dsn, $m) < 1){ 00140 perror('<code>zigmoyd.cde.dnsExplode</code><br />Failed to Parse as Invalid DNS Specified'); 00141 return false; 00142 } 00143 for($i = 0;$i<count($m);++$i){ 00144 if(isset($m[$i]))unset($m[$i]); 00145 } 00146 if(!isset($m['table'])){ 00147 $m['table'] = $m['schema']; 00148 unset($m['schema']); 00149 } 00150 return $m; 00151 }

| zCDE::createConn | ( | $ | conAliasName, | |
| $ | drv, | |||
| $ | database = null, |
|||
| $ | host = null, |
|||
| $ | user = null, |
|||
| $ | psw = null, |
|||
| $ | port = null | |||
| ) |
Create a Connection File (returns false if file already exists).
| $conAliasName | string | |
| $drv | string | |
| $database | string | |
| $host | string Optional | |
| $user | string Optional | |
| $psw | string Optional | |
| $port | int Optional |
Definition at line 164 of file zcde.php.
00164 { 00165 $path = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.ZIGSETTINGSDIR.DRS.Z_DIR_ETC_CONF.DRS.$conAliasName.".con.ini.php"; 00166 if(file_exists($path))return false; 00167 $iniStr = "driver=\"$drv\"\ndatabase=\"$database\"\nhost=\"$host\"\nuser=\"$user\"\npsw=\"$psw\"\nport=\"$port\""; 00168 return file_put_contents($path, $iniStr); 00169 }
| zCDE::deleteConn | ( | $ | conAliasName | ) |
Delete a Connection File.
| $connAliasName | string |
Definition at line 176 of file zcde.php.
00176 { 00177 $path = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.ZIGSETTINGSDIR.DRS.Z_DIR_ETC_CONF.DRS.$conAliasName.".con.ini.php"; 00178 if(!file_exists($path))return false; 00179 return unlink($path); 00180 }
| zCDE::overWriteConn | ( | $ | conAliasName, | |
| $ | drv, | |||
| $ | database = null, |
|||
| $ | host = null, |
|||
| $ | user = null, |
|||
| $ | psw = null, |
|||
| $ | port = null | |||
| ) |
Creates a Connection File (Over Writes if already exist).
| $conAliasName | string | |
| $drv | string | |
| $database | string | |
| $host | string Optional | |
| $user | string Optional | |
| $psw | string Optional | |
| $port | int Optional |
Definition at line 193 of file zcde.php.
00193 { 00194 $path = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.ZIGSETTINGSDIR.DRS.Z_DIR_ETC_CONF.DRS.$conAliasName.".con.ini.php"; 00195 $iniStr = "driver=\"$drv\"\ndatabase=\"$database\"\nhost=\"$host\"\nuser=\"$user\"\npsw=\"$psw\"\nport=\"$port\""; 00196 return file_put_contents($path, $iniStr); 00197 }
| zCDE::parseConn | ( | $ | conAliasName | ) |
Parse the Connection file into an array.
| $conAliasName | string |
Definition at line 204 of file zcde.php.
00204 { 00205 $path = ZIGROOT.DRS.Z_DIR_PROJECTS.DRS.Z_PROJECT_DIR.DRS.ZIGSETTINGSDIR.DRS.Z_DIR_ETC_CONF.DRS.$conAliasName.".con.ini.php"; 00206 if(file_exists($path))return false; 00207 return parse_ini_file($path); 00208 }
1.5.6