~desarrollokumbia/kumbia/ActiveRecord

« back to all changes in this revision

Viewing changes to db_pool/metadata.php

  • Committer: Deivinson Tejeda
  • Date: 2010-01-22 22:44:49 UTC
  • Revision ID: deivinsontejeda@gmail.com-20100122224449-8a03r26ppfuz3963
1->Arreglando el find() para que funcione con y sin chain
2->En el DbQuery 
        ->En el método where se recibe un array para realizar las consultas preparadas (Prepared Statement)
        ->se agrega método para obetener los params para enlazar al SQL
        ->Se agrega método column para indicar las columnas que se quiere en la consulta

3->En el DbAdapter en la construcción del Query en el where se hace un implode directo ya que la consulta es preparada

Ejemplo
//Modelo
    public function buscar()
    {
        $this->get()->columns('nombre, id')
                    ->where(array('id > ?'=>2, 'id<?'=>5))
                    ->limit(2);

        //ejecuta un find() personalizado via chain
        return $this->find();
                         
    }

//Otra forma
    public function buscar()
    {
        //ejecuta un find() por defecto
        return $this->find();
    }

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
class Metadata
27
27
{
28
28
    /**
29
 
     * Atributos de modelo (metadata)
 
29
     * Atributos de modelo
30
30
     *
31
31
     * @var array
32
32
     **/
33
33
    private $_attributes = array();
34
 
 
35
 
        /**
36
 
         * Lista de atributos
37
 
         * 
38
 
         * @var array 
39
 
         */
40
 
        private $_attributesList = array();
41
34
    
42
35
    /**
43
36
     * Clave primaria
63
56
    {
64
57
        if (! isset($this->_attributes[$attribute])) {
65
58
            $this->_attributes[$attribute] = new Attribute();
66
 
                        $this->_attributesList[] = $attribute;
67
59
        }
68
60
        return $this->_attributes[$attribute];
69
61
    }
70
 
        
71
62
    /**
72
63
     * Obtiene los atributos
73
64
     *
79
70
    }
80
71
    
81
72
    /**
82
 
     * Obtiene la lista de atributos
83
 
     *
84
 
     * @return array
85
 
     */
86
 
    public function getAttributesList()
87
 
    {
88
 
        return $this->_attributesList;
89
 
    }
90
 
        
91
 
    /**
92
73
     * Asigna la clave primaria
93
74
     *
94
75
     * @param string $pk
127
108
    {
128
109
        return $this->_FK;
129
110
    }
130
 
}
 
111
}
 
 
b'\\ No newline at end of file'