Fixed #3830 Can't export custom query because it lowercases table names
Used preg_split() instead of explode() to split sql query,
Since explode is case sensitive and if table or column contains substring "where" it will give an error
Merge remote-tracking branch 'upstream/master'