Welcome Guest, Not a member yet? Register   Sign In
sql is not compiled properly
#11

(This post was last modified: 04-18-2015, 06:20 AM by cperrot.)

another error I found.

sending in this code results in
PHP Code:
$this->db->select_sum('amount * quantity''amount'); 

results as
Code:
SUM(`amount *` `quantity`) AS `amount`

the code responsible for the false quotes is

PHP Code:
public function protect_identifiers($item$prefix_single FALSE$protect_identifiers NULL$field_exists TRUE)
.......
 elseif (
$offset strrpos($item' '))
 {
 
$alias = ($protect_identifiers)
 ? 
' '.$this->escape_identifiers(substr($item$offset 1))
 : 
substr($item$offset);
 
$item substr($item0$offset);
 } 

another issue I found that
PHP Code:
public function select_sum($select ''$alias ''
and
PHP Code:
protected function _max_min_avg_sum($select ''$alias ''$type 'MAX'

do not take protect_identifiers as a parameter like many other db functions do but just use the global

$this->_protect_identifiers

Honestly the database layer is need of a general overhaul. I have been looking into this only for 30 minutes and found 3 errors.
In general I must say that the database layer is inconsistent and badly programmed.
Reply


Messages In This Thread
sql is not compiled properly - by cperrot - 12-31-2014, 08:51 AM
RE: sql is not compiled properly - by jlp - 12-31-2014, 04:06 PM
RE: sql is not compiled properly - by cperrot - 12-31-2014, 11:30 PM
RE: sql is not compiled properly - by mwhitney - 01-07-2015, 12:28 PM
RE: sql is not compiled properly - by cperrot - 01-08-2015, 12:52 AM
RE: sql is not compiled properly - by cperrot - 01-08-2015, 12:53 AM
RE: sql is not compiled properly - by mwhitney - 01-08-2015, 09:36 AM
RE: sql is not compiled properly - by zepernick - 01-14-2015, 06:56 AM
RE: sql is not compiled properly - by CroNiX - 01-21-2015, 04:34 PM
RE: sql is not compiled properly - by cperrot - 04-18-2015, 12:19 AM
RE: sql is not compiled properly - by cperrot - 04-18-2015, 06:09 AM
RE: sql is not compiled properly - by cperrot - 04-18-2015, 06:56 AM
RE: sql is not compiled properly - by cperrot - 11-02-2016, 11:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB