File Query.php, function get

File Query.php, function get

l.breschi@saperi.eul.breschi@saperi.eu Posts: 3Questions: 0Answers: 0

Since I upgraded to 1.8.0 version there's something strange in the query results. It seems that the split of the fields is not happening correctly when you pass a string param to the get function.

I fixed restoring the preg_split function in the code (like it was in the previous version).

/* 1.8.0 */
$this->_field[] = trim( $get );" 
/* Previous version */
$fields = preg_split( "/,(?![^()]*+\\))/", $args[$i] );

for ( $j=0 ; $j<count($fields) ; $j++ ) {
    $this->_field[] = trim( $fields[$j] );
}

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin

    Can you show me what you are using for your Editor call that causes an issue please? The reason for that change was to allow greater expression in SQL functions for fields.

    Allan

  • l.breschi@saperi.eul.breschi@saperi.eu Posts: 3Questions: 0Answers: 0

    Hi Allan,

    Here's two of many scripts having that behaviour.

    $fields = $this->bfhc()->is()
                        ->query("select", "COLUMNS C")
                        ->distinct(true)
                        ->get("C.TABLE_CATALOG, C.TABLE_SCHEMA, C.TABLE_NAME, C.COLUMN_NAME, C.ORDINAL_POSITION, C.COLUMN_DEFAULT, C.IS_NULLABLE, C.DATA_TYPE, C.CHARACTER_MAXIMUM_LENGTH, C.CHARACTER_OCTET_LENGTH, C.NUMERIC_PRECISION, C.NUMERIC_SCALE, C.DATETIME_PRECISION, C.CHARACTER_SET_NAME, C.COLLATION_NAME, C.COLUMN_TYPE, C.COLUMN_KEY, C.EXTRA, C.PRIVILEGES, C.COLUMN_COMMENT, K.CONSTRAINT_NAME, K.POSITION_IN_UNIQUE_CONSTRAINT, K.REFERENCED_TABLE_NAME, K.REFERENCED_COLUMN_NAME, K.REFERENCED_TABLE_SCHEMA")
                        ->join("KEY_COLUMN_USAGE K", "C.TABLE_CATALOG = K.TABLE_CATALOG and C.TABLE_SCHEMA = K.TABLE_SCHEMA and C.TABLE_NAME = K.TABLE_NAME and C.COLUMN_NAME = K.COLUMN_NAME", "left")
                        ->and_where( "C.TABLE_CATALOG", $this->bfhc()->sqlcfg()["catalog"])
                        ->and_where( "C.TABLE_SCHEMA", $this->bfhc()->sqlcfg()["schema"])
                        ->and_where( "C.TABLE_NAME", $this->tablename())
                        ->order("C.ORDINAL_POSITION ASC, K.POSITION_IN_UNIQUE_CONSTRAINT ASC")
                        ->exec()
                        ->fetchAll();
    
    $roots = $bfhc->db()->select("treetab", "id, parent, position, name, value", null, "parent, position, name")->fetchAll();
    

    Please, note that these codes and the classes related haven't been changed since more than an year.

    Thanks for the support.
    L.

This discussion has been closed.