At the MySQL Developers Meeting in Heidelberg there were show off sessions where each team had a chance of showing their best to others.
As part of this shut out presentation, I demonstrated some MySQL Proxy magic.
This is a sample session from that presentation.
mysql> select 1 + 1;As an exercise for the reader, you can figure out the Lua script that made the above exchange possible.
+-------------------------------+
| ERROR |
+-------------------------------+
| Don't understand these digits |
+-------------------------------+
1 row in set (0.00 sec)
# Hmmm!
# Let's try to make it understand ...
mysql> set sql_mode='english_digits'; # You did not know we could do that. Did you?
Query OK, 42 rows affected (0.01 sec)
mysql> select 1 + 1;
+--------+
| result |
+--------+
| two |
+--------+
1 row in set (0.00 sec)
# Clever!
# perhaps it understands something more
mysql> select 1 + two;
+--------+
| result |
+--------+
| three |
+--------+
1 row in set (0.00 sec)
# Ok. What about two numbers?
mysql> select seven + two;
+--------+
| result |
+--------+
| nine |
+--------+
1 row in set (0.00 sec)
# Very good. Now how about something other than adding numbers?
mysql> select seven * two;
+----------+
| result |
+----------+
| fourteen |
+----------+
1 row in set (0.00 sec)
# Pushing it a bit ?
mysql> select seven * three;
+-----------------------------------------------+
| result |
+-----------------------------------------------+
| Can't count beyond my fingers and toes. (21?) |
+-----------------------------------------------+
1 row in set (0.00 sec)
# Well, it has some limitations!
No comments:
Post a Comment