> Dear Group: > > When my application launches I want to open the associated database, and if > that fails because the file does not exist then I would create a new > database. > > sqlite3_open_v2() is ideal for this purpose because you can leave out > SQLITE_OPEN_CREATE flag, and specify SQLITE_OPEN_READWRITE. > > Unfortunately, this is all academic because I am using sqlite3_open16()! > Where is the UTF-16 version that accepts the flags as a parameter? How can I > achieve the same functionality? Let me add that I am not too keen on > modifying sqlite.c so thats not an option (too much hassle when new versions > come out). > > How did this oversight happen? And what is the workaround? How can I tell, > after a call to sqlite3_open16() if the database was created? The first thing > I do when it opens is SELECT * FROM VERSION to see if I have to upgrade the > database to a new version of my application data. I guess that call could > fail and that would be my clue to create all the tables. > > But what if the SELECT fails for a different reason? How do I distinguish it? > How do I make this robust? > > Thanks!
I would assume the intent is that you convert your UTF-16 filename to UTF-8, and then call sqlite3_open_v2(). I don't know what platform you are running on, but you may have some conversion APIs available to you. If not, unicode.org provides some nice sample code that performs the conversion: http://unicode.org/faq/utf_bom.html#UTF8 ~Eric _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users