Morgan Tocker ([info]mtocker) wrote,
@ 2008-06-18 21:17:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Entry tags:mysql

SQL comments - commenting out code for earlier versions
In MySQL, it's possible to comment out portions of code that you only want to work in specific MySQL versions:

i.e.
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `a` /*!40100 DEFAULT CHARACTER SET latin1 */;

The problem with this, is that the decimal point is omitted - and there's a real assumption that with something like 3.23.12 the "12" portion never exceeds 99.

When I look at 5.0, MySQL is currently at 5.0.60 - and there are still minor changes happening. 5.1 is at 5.1.25, and not even GA. Assuming that 5.1 does the same community/enterprise split and shuffles through releases in even numbers, how long will it take before we have 5.1.100?

If we do get there, the SQL commenting feature will need upgrading.




(Post a new comment)

And don't forget the split enterprise/community thing
[info]arjen_lentz
2008-06-19 03:14 am UTC (link)
This already doesn't work (and Eric Bergen commented on this years ago) because of the community/enterprise split. Some features may be present in one but not the other, and thus a simple >= version check is not sufficient.

Naturally, it would have been quite brilliant if MySQL had considered this before doing the split, and had -at that time- put syntax in place to deal with the split. Then most people would now have servers running that support the syntax. But that didn't happen, so they don't.

Of course it's harmless in the sense that since it's wrapped in a comment, unknown stuff does not get executed. But it makes the exact story of "when is something executed" a bit more complicated to track.

(Reply to this)

ICE Online games
(Anonymous)
2008-09-13 12:47 am UTC (link)
Visit now! http://iceonlinegames.com

(Reply to this)


Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…