graker / oc-photoalbums-plugin

Photo albums plugin for OctoberCMS
MIT License
12 stars 8 forks source link

Radnoimzre #2

Closed amdad closed 7 years ago

amdad commented 7 years ago

Thanks for very nice plugin.

An exception has been thrown during the rendering of a template ("SQLSTATE[HY000]: General error: 1 no such function: RAND (SQL: select * from "graker_photoalbums_photos" order by RAND() asc limit 5)").

When using RandomPhotos Component on SQLite.

graker commented 7 years ago

Hi @amdad

Yup, at the moment this component works for MySQL only. There's no DB-independent rand sorting function in Laravel 5.0. IIRC, they introduced one in 5.2.

The component code should be rewritten though so it won't throw exceptions with other DB drivers like I did here. I will add this in a couple of days and post an update.

amdad commented 7 years ago

October will be updated to L5.5. So this will be. Thanks for reply and plugin!

graker commented 7 years ago

I didn't know that. Great news, thanks!

amdad commented 7 years ago

https://twitter.com/octobercms/status/843642213678505984

graker commented 7 years ago

The issue is fixed, now RANDOM() will be used for Sqlite, RAND() for MySQL and other databases would just return non-random collection.

After October updates to 5.5 I will update the component to use DB-independent function.

amdad commented 7 years ago

Coooool! Thanks!