-
MySQL substring start is one based
To my surprise, MySQL SUBSTRING functions start position is one based. A start position of ‘0’ will return an empty string. If you would like to get the first 100 characters of a column named ‘my_column’ you will need to use SUBSTRING(‘my_column’, 1, 100). Using SUBSTRING(‘my_column’, 0, 100). will return an empty string. Postgres and…
-
InnoDB + MySQL Implicit Autocommit
Today, I spent about an hour debugging a part of the script that I was writing. This is what I faced: I had a function writing some logs into a table. The function was pretty simple as all it had to do was insert some data into a row (using the data passed to it).…