public function __construct()
 {
     parent::__construct();
     $this->load->database();
     $db_driver = $this->db->platform();
     $this->class_name = 'grocery_crud_model_' . $db_driver;
 }
Exemplo n.º 2
0
 function build_relation_n_n_subquery($field, $selection_table, $relation_table, $primary_key_alias_to_selection_table, $primary_key_selection_table, $primary_key_alias_to_this_table, $field_name)
 {
     if ($this->subdriver == 'pgsql') {
         return "(SELECT string_agg(" . $this->protect_identifiers($field) . ", ',') FROM " . $this->protect_identifiers($selection_table) . " LEFT JOIN " . $this->protect_identifiers($relation_table) . " ON " . $this->protect_identifiers($relation_table . "." . $primary_key_alias_to_selection_table) . " = " . $this->protect_identifiers($selection_table . "." . $primary_key_selection_table) . " WHERE cast(" . $this->protect_identifiers($relation_table . "." . $primary_key_alias_to_this_table) . " as character varying ) = cast(" . $this->protect_identifiers($this->table_name . "." . $this->get_primary_key()) . "  as character varying ) GROUP BY " . $this->protect_identifiers($relation_table . "." . $primary_key_alias_to_this_table) . ") AS " . $this->protect_identifiers($field_name);
     } else {
         return parent::build_relation_n_n_subquery($field, $selection_table, $relation_table, $primary_key_alias_to_selection_table, $primary_key_selection_table, $primary_key_alias_to_this_table, $field_name);
     }
 }
 public function __construct()
 {
     parent::__construct();
     // set field_types
     if (self::$__FIELD_TYPES == null) {
         self::$__FIELD_TYPES = array();
     }
     // this is a simple hack to get ESCAPE_CHAR
     $test = $this->protect_identifiers('t');
     $first_char = substr($test, 0, 1);
     if ($first_char !== 't') {
         $this->ESCAPE_CHAR = $first_char;
     }
 }