Search code examples
javascriptandroidsqltitanium

insert special characters in local database for titanium


I want to insert special characters like '@', ''', '"','&' etc in titanium local database. can any body tell me that what's the exact way of doing that. I've searched but couldn't find. currently i'm using this query to insert data

var passaction='string plus any special character//& ';
var db = Titanium.Database.open('dogs');


db.execute('INSERT INTO myinfodb (id, company) VALUES(?,?)', 1, passaction);

any help would be much appreciated.

Thanks!


Solution

  • As long as your database file is in UTF-8 this shouldn't be a problem, just include the special characters inside a single-quote:

    db.execute("INSERT INTO myinfodb (id, company) VALUES('®™ other characters')", 1, passaction);