Migrate database engine from MySQL to SQLite: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
mNo edit summary
Tags: Mobile edit Mobile web edit
Line 14: Line 14:
INSTR(string, substring);
INSTR(string, substring);
</pre>
</pre>
* Other functions not supported: SET


== References ==
== References ==

Revision as of 15:38, 2 November 2019

Notes

  • Remove database name from SQL query: SQLite will consider the database name as table name
  • In MySQL, string are able to quoted with single quote symbol ' or double quote symbol ". In SQLite the string quoted with double quote symbol will be considered as column name! It will cause the problem: "no such column: xxx"
  • Replace the following functions
    • Replace MySQL CHAR_LENGTH function with SQLite Length function[1]
    • Replace MySQL IF function with SQLite CASE function
    • Replace MySQL LOCATE function[2] with SQLite INSTR CASE function[3]
-- MySQL
LOCATE(substr,str), LOCATE(substr,str,pos)

-- SQLite
INSTR(string, substring);
  • Other functions not supported: SET

References