jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Author Topic: jddatabase.php addJoinKeys bug  (Read 13515 times)

Finarfin

  • Full Member
  • ***
  • Posts: 119
    • View Profile
jddatabase.php addJoinKeys bug
« 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;
        }



Logged

Harald Leithner

  • Administrator
  • Hero Member
  • *****
  • Posts: 1688
    • View Profile
Re: jddatabase.php addJoinKeys bug
« Reply #1 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.
Logged
Joomla! 5.0 Release Manager
Vote at JED