jDiction Forum

English => General Questions => Topic started by: Finarfin on January 11, 2013, 08:47:53 pm

Title: jddatabase.php addJoinKeys bug
Post by: Finarfin on January 11, 2013, 08:47:53 pm
Just you know, if the $sql argument passed have more than two tables in the from, something like

Select * from actual as a, brave as b


It will happen a sql error cause the constructed query here

$sql->select($alias.'.'.$primarykey.' AS JD_MAGIC_KEY_'.$jdkey);

will be something as

select a,.id as JD_MAGIC_KEY_1

I donĀ“t know if this bug only happened to me because we are doing something strange in our module, but here is for you to know ;)

By the way, we solved it with a simple

        $alias = str_ireplace(',', '', $alias);

before

        if ($alias == '') {
          $alias = $tablename;
        }



Title: Re: jddatabase.php addJoinKeys bug
Post by: Harald Leithner on January 11, 2013, 09:05:48 pm
Could you please give me the complete original query and are you using jdatabasequery to construct it.

because its seams to fail to find the correct table alias "a".

And if I see it correct you are using jdatabasequery maybe you could give me the php code where the from clause is in.