Enter SQL directly
- sackbut
-
Topic Author
- Offline
Less
More
- Posts: 32
- Thank you received: 5
8 years 7 months ago #3915
by sackbut
Enter SQL directly was created by sackbut
Here is something that I think would be really useful....
{joodb sql}Your SQL string here{/joodb}
I have a list of meetings which I can sort by meeting date. I'd like to show only those meetings still to come ie where their date is > today. I discovered that the template script will run PHP if you have Sorcerer installed as a Joomla plugin, so it is easy to build the WHERE clause.
But there is no way I can see to use "raw" SQL to return a recordset with joodb
(I know you can set a WHERE clause in the admin panel, but I'd like this to be automatic )
I'd pay for that
{joodb sql}Your SQL string here{/joodb}
I have a list of meetings which I can sort by meeting date. I'd like to show only those meetings still to come ie where their date is > today. I discovered that the template script will run PHP if you have Sorcerer installed as a Joomla plugin, so it is easy to build the WHERE clause.
But there is no way I can see to use "raw" SQL to return a recordset with joodb
(I know you can set a WHERE clause in the admin panel, but I'd like this to be automatic )
I'd pay for that
Please Log in to join the conversation.
- Dirk
-
- Offline
Less
More
- Posts: 1222
- Thank you received: 226
8 years 7 months ago #3917
by Dirk
Replied by Dirk on topic Enter SQL directly
It is much to dangerous to allow SQL conditions as search condition.
But there are another possibilities.
1: The searchfield option in JoodbPro.
{joodb searchfield|eventdate|min} would allow you to enter a minimum value for eventdate.
joodb.feenders.de/support/documentation.html?search=searchfield
2: The SQL - Where Parameter for the Catalog-Menu-Entry
Just enter something like
And the catalog shows only entries with eventdate >= today!
But there are another possibilities.
1: The searchfield option in JoodbPro.
{joodb searchfield|eventdate|min} would allow you to enter a minimum value for eventdate.
joodb.feenders.de/support/documentation.html?search=searchfield
2: The SQL - Where Parameter for the Catalog-Menu-Entry
Just enter something like
'eventdate' >= CURDATE()
And the catalog shows only entries with eventdate >= today!
Please Log in to join the conversation.
- sackbut
-
Topic Author
- Offline
Less
More
- Posts: 32
- Thank you received: 5
8 years 7 months ago - 8 years 7 months ago #3919
by sackbut
Replied by sackbut on topic Enter SQL directly
That's what I want - excellent.
One further question - how can I implement the LIMIT clause ? For the front page of the site I just want only the NEXT event.
Thanks
After thinking about this I think it could done by setting the limit on the menu item to 1. Another menu item ( for the same table) for a different purpose could have a different limit. But can you insert the output of joodb directly into an article instead of onto its own page ?
One further question - how can I implement the LIMIT clause ? For the front page of the site I just want only the NEXT event.
Thanks
After thinking about this I think it could done by setting the limit on the menu item to 1. Another menu item ( for the same table) for a different purpose could have a different limit. But can you insert the output of joodb directly into an article instead of onto its own page ?
Last edit: 8 years 7 months ago by sackbut. Reason: Afterthought
Please Log in to join the conversation.
- sackbut
-
Topic Author
- Offline
Less
More
- Posts: 32
- Thank you received: 5
8 years 7 months ago #3931
by sackbut
Replied by sackbut on topic Enter SQL directly
Another thought
It would be very useful to have the SQL LIMIT clause as pert of the {jooDB} syntax. With that, and the things you mention above, you have most of the simple SQL.
I know you can set a limit on the Menu, but it is clunky to have to set a new menu item whenever you want to change the limit parameter
It would be very useful to have the SQL LIMIT clause as pert of the {jooDB} syntax. With that, and the things you mention above, you have most of the simple SQL.
I know you can set a limit on the Menu, but it is clunky to have to set a new menu item whenever you want to change the limit parameter
Please Log in to join the conversation.
Moderators: Dirk, joest