public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Removed the dbo directory and mysql specific function for getting the 
columns in the table
Changed get_columns_in_table to return a hash with the name and all of the 
other details as the value

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4231 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Mon Oct 15 17:08:35 -0700 2007
commit  69bbda166d7da249fdb700e97f94089a319315ac
tree    9bdef14e8c21572f579d2318672c1bd9e409b25e
parent  8c928dfad853d52b5a02848df0526ba9f5abc6dc
...
131
132
133
134
 
135
136
137
...
775
776
777
778
 
779
780
781
...
1059
1060
1061
1062
 
1063
1064
1065
1066
1067
1068
1069
 
 
 
 
 
1070
1071
1072
...
131
132
133
 
134
135
136
137
...
775
776
777
 
778
779
780
781
...
1059
1060
1061
 
1062
1063
 
 
 
 
 
 
1064
1065
1066
1067
1068
1069
1070
1071
0
@@ -131,7 +131,7 @@ abstract class CmsObjectRelationalMapping extends CmsObject implements ArrayAcce
0
     //Setup the predefined fields in the $params array. Relax: The definitions are cached.
0
     $fields = $this->get_columns_in_table();
0
     if (count($fields) > 0) {
0
- foreach ($fields as $field) {
0
+ foreach ($fields as $field=>$data) {
0
         if (array_key_exists($field, $this->field_maps)) $field = $this->field_maps[$field];
0
         if (!array_key_exists($field, $this->params)) {
0
           $this->params[$field] = '';
0
@@ -775,7 +775,7 @@ abstract class CmsObjectRelationalMapping extends CmsObject implements ArrayAcce
0
         $midpart = '';
0
         $queryparams = array();
0
 
0
- foreach($fields as $onefield)
0
+ foreach($fields as $onefield=>$obj)
0
         {
0
           $localname = $onefield;
0
           if (array_key_exists($localname, $this->field_maps)) $localname = $this->field_maps[$localname];
0
@@ -1059,14 +1059,13 @@ abstract class CmsObjectRelationalMapping extends CmsObject implements ArrayAcce
0
   
0
   function _get_columns_in_table($table)
0
   {
0
- $config = cms_config();
0
+ $fields = array();
0
 
0
- $dbms = $config['dbms'];
0
- if ($dbms == 'mysqli') $dbms = 'mysql';
0
-
0
- include_once(cms_join_path(ROOT_DIR, 'lib', 'dbo', "{$dbms}.get_columns_in_table.php"));
0
-
0
- $fields = dbo_get_columns_in_table($table);
0
+ $cols = cms_db()->MetaColumns($table);
0
+ foreach ($cols as $k=>$v)
0
+ {
0
+ $fields[$v->name] = $v;
0
+ }
0
     
0
     return $fields;
0
   }

Comments

    No one has commented yet.