~desarrollokumbia/kumbia/ActiveRecord

« back to all changes in this revision

Viewing changes to db_pool/adapthers/pgsql_db.php

  • Committer: Deivinson Tejeda
  • Date: 2009-12-29 20:19:46 UTC
  • Revision ID: deivinsontejeda@gmail.com-20091229201946-1gp26mpeaman9a7f
arreglos en los atributos de la class Column y adecuando el adaptador de pgsql

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
                    //valor por defecto
66
66
                    if (! is_null($field->default)) {
67
67
                        if (strpos($field->default, 'nextval(') !== FALSE) {
68
 
                            $column->_isAutoIncrement = TRUE;
 
68
                            $column->autoIncrement = TRUE;
69
69
                        } elseif ($field->type == 'serial' || $field->type == 'bigserial') {
70
 
                            $column->_isAutoIncrement = TRUE;
 
70
                            $column->autoIncrement = TRUE;
71
71
                        } else {
72
 
                            $column->_default = $field->default;
 
72
                            $column->default = $field->default;
73
73
                        }
74
74
                    }
75
75
                    //puede ser null?
76
76
                    if($field->null == 'NO'){
77
 
                        $column->_isNull = FALSE;
 
77
                        $column->notNull = FALSE;
78
78
                    }
79
79
                    //Relaciones
80
80
                    if(substr($field->name, strlen($field->name) -3, 3) == '_id'){
81
 
                        $column->_relation = substr($field->name, 0, -3);
82
 
                        $row->setRelation($field->name, $column->_relation);
 
81
                        $column->relation = substr($field->name, 0, -3);
 
82
                        $row->setRelation($field->name, $column->relation);
83
83
                    }
84
84
                    //tipo de dato
85
 
                    $column->_dbType = $field->type;
 
85
                    $column->type = $field->type;
86
86
                    //longitud
87
 
                    $column->_length = $field->length;
 
87
                    $column->length = $field->length;
88
88
                    //indices
89
89
                    switch ($field->index){
90
90
                        case 'PRI':
91
91
                            $row->setPK($field->name);
 
92
                            $column->PK = TRUE;
92
93
                            break;
93
94
                        case 'FK':
94
95
                            $row->setFK($field->name);
 
96
                            $column->FK = TRUE;
95
97
                            break;
96
98
                        case 'UNI':
97
 
                            $column->_isUni = TRUE;
 
99
                            $column->unique = TRUE;
98
100
                            break;
99
101
                    }
100
102
                }