SQL
The MTSQL tag can use SELECT statements like MySQL and PHP statements can.
<MTSQLEntries query="select entry_id from mt_entry
where entry_title like '%Movable Type%'">
<a href="<MTEntryLink>"><MTEntryTitle></a><br />
</MTSQLEntries>
The MTSQL tag can use SELECT statements like MySQL and PHP statements can.
<MTSQLEntries query="select entry_id from mt_entry
where entry_title like '%Movable Type%'">
<a href="<MTEntryLink>"><MTEntryTitle></a><br />
</MTSQLEntries>
Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.
Copyright 2007-2009 Six Apart Ltd. Some Rights Reserved
linh.myopenid.com
June 24, 2008 4:11 PM | Reply
SQL is installed on MT 4.1. When ran with a simple query, nothing is returned, and there are
no errors or messages in the apache log files. Is this plugin compatible with 4.1? Thanks, - l -
Unicorn Ninja
December 24, 2008 6:44 AM | Reply
This might be the most useful plugin for MT yet. For someone attempting to highly customize a blog, this is extremely helpful. Thank you!
Drazend
January 3, 2009 3:20 AM | Reply
I installed this plugin on MT 4.2 and I get this:
"Cannot call method 'cfg' on object 'MT::ObjectDriver::Driver::Cache::RAM=HASH(0x886dcfc)' at /xxxxxxx/extlib/bradchoate/sql.pm line 602 "
Any idea what might be wrong?
Drazend
January 3, 2009 3:45 AM | Reply
Problem resolved by updating to SQL plugin 2.0 (had V 1.5).
Diana Schnuth
January 4, 2009 4:26 PM | Reply
I attempted to use a less-than in a where clause in a query (entry _ authored _ on < '[MTEntryDate format_name='iso8601']'), and discovered that the plugin gave me SQL syntax errors until I changed the < symbol to the & l t ; HTML escape character.
Just wanted to document that here, in case anyone else came across the same problem.
Bobb Menk
May 16, 2009 7:37 AM | Reply
Can anyone confirm if this plugin actually works with MT 4.2.3 with an Oracle backend?
Initial tests indicated that the plain MTSQL tag would work and that we could then use regular MT tags like MTEntry inside the MTSQL enclosure to display results. However right now we're having trouble even with that, so I'm hoping to get a definitive answer.
We know the queries work using other tools to run them against the MT db, and we're not getting any syntax errors from the templates, so I'm trying to determine if it's the plugin itself or something outside of it.
Thanks for any light anyone can shed on this.
Bobb Menk
May 18, 2009 12:36 PM | Reply
Having worked on this a bit more, it now appears that with an Oracle backend, this plugin is limited to just the use of the MTSQL tag itself and the MTSQLColumn tag within that container. Regular MT tags do not appear to work, nor do the variants supplied by the plugin such as MTSQLEntries, etc. work.
It would be nice to be proven wrong on this, as it reduces the flexibility of the plugin significantly, but so far, that's all we've been able to make it do.