In reference to DBUTILS escapefield() I see a reference to "db escape character" and am wondering what a "db escape character" is for. I am a pretty new at SQL and have never used sqlite at all.
It is important to watch the SQL video tutorial and use parameterized queries.
EscapeField is a private sub in DBUtils. Wrapping fields / columns names with square brackets allows using spaces inside the column names.
B4X:
"Select col1, col2, col3 FROM table1" 'good
"Select [col1], [col2], [col3] FROM table1" 'also good
"Select col 1, col2, col3 FROM table1" 'not good
"Select [col 1], [col2], [col3] FROM table1" 'good
I don't recommend using spaces or other characters that need to be escaped in the column names.
It is important to watch the SQL video tutorial and use parameterized queries.
EscapeField is a private sub in DBUtils. Wrapping fields / columns names with square brackets allows using spaces inside the column names.
B4X:
"Select col1, col2, col3 FROM table1" 'good
"Select [col1], [col2], [col3] FROM table1" 'also good
"Select col 1, col2, col3 FROM table1" 'not good
"Select [col 1], [col2], [col3] FROM table1" 'good
I don't recommend using spaces or other characters that need to be escaped in the column names.
So unless I want to include spaces in field names I dont need to use it? I have always assumed that spaces were a no-no and have never felt the need to use them. And thanks for the very quick response!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.