#1 2015-05-25 14:10:28

gandycz
Member
2015-03-29
27

Web API problem

Hello/Hi/Greetings,

When i try to return with API this:

http://iphoto.macweb.cz/ws.php?format=r … order=name

or any type of order by... (if i put order by away is ok but what if i need to sort it?)

i get this mysql error:

[mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'name' at line 7

SELECT id
  FROM ip2_images i
    INNER JOIN ip2_image_category ic ON id=ic.image_id
    INNER JOIN ip2_image_tag it ON id=it.image_id
    WHERE tag_id IN (261)
  GROUP BY id
name

Piwigo version: 2.7.4

Offline

 

#2 2015-05-25 14:53:09

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Web API problem

the error is in http://piwigo.org/dev/browser/trunk/inc … s.php#L113
"ws_std_image_sql_order" does not prepend 'ORDER BY'

Offline

 

#3 2015-05-26 11:59:02

nicolas
Former Piwigo Team
2004-12-30
1233

Re: Web API problem

It looks very strange for me. I cannot reproduce the issue.

mistic100 wrote:

the error is in http://piwigo.org/dev/browser/trunk/inc … s.php#L113
"ws_std_image_sql_order" does not prepend 'ORDER BY'

You're right ws_std_image_sql_order() does not prepend "ORDER BY" but with a query like

Code:

ws.php?format=rest&method=pwg.tags.getImages&tag_name=best1&per_page=1&order=name

params array given to ws_std_image_sql_order() contains order key and that function return 'i.name'.

"ORDER BY" is prepend at line 116 because $order_by is not empty.

Offline

 

#4 2015-05-26 12:06:18

nicolas
Former Piwigo Team
2004-12-30
1233

Re: Web API problem

I understand. I tried to reproduce issue on piwigo developement version and the issue has already been reported and fixed :
http://piwigo.org/bugs/view.php?id=3163

and fixed in

http://piwigo.org/dev/changeset/30359

Sorry for noise!

Offline

 

#5 2015-05-26 13:00:12

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Web API problem

oops I read the code too fast :)

Offline

 

#6 2015-05-26 13:00:58

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Web API problem

rvelices why it wasn't merged in working branch ?

Offline

 

#7 2015-05-26 14:28:13

rvelices
Former Piwigo Team
2005-12-29
1960

Re: Web API problem

mistic100 wrote:

rvelices why it wasn't merged in working branch ?

Probably forgot about it   ...

Offline

 

#8 2015-05-26 15:07:26

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: Web API problem

you targeted 2.8.0 so I though there was a reason

Offline

 

#9 2015-06-10 08:37:45

gandycz
Member
2015-03-29
27

Re: Web API problem

So it will be fixed in 2.8.0? I actually build my portfolio page on that API so i would be very happy that sorting work since then. It takes some time since then becouse adobe have a lot of bugs in export scripts so i wait first that they fix something too :).

Offline

 

#10 2015-06-16 14:10:26

gandycz
Member
2015-03-29
27

Re: Web API problem

Thanks i use this fix and its ok. Now my web portfolio works as i hope.


nicolas wrote:

I understand. I tried to reproduce issue on piwigo developement version and the issue has already been reported and fixed :
http://piwigo.org/bugs/view.php?id=3163

and fixed in

http://piwigo.org/dev/changeset/30359

Sorry for noise!

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2025 · Contact