• Currently 5/5
  • 1
  • 2
  • 3
  • 4
  • 5
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>

7 Comments

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 -

This might be the most useful plugin for MT yet. For someone attempting to highly customize a blog, this is extremely helpful. Thank you!

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?

Problem resolved by updating to SQL plugin 2.0 (had V 1.5).

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.

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.

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.

Leave a comment

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.