Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Thanks a lot ! Le 15/10/12 18:27, Joe Mistachkin a écrit : Vincent DARON wrote: There is now way to know if the query is on a View or a Table while generating the SQL. The core SQLite library has been enhanced to deal with this situation, here: http://www.sqlite.org/src/info/5526e0aa3c -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Vincent DARON wrote: > > There is now way to know if the query is on a View or a Table while > generating the SQL. > The core SQLite library has been enhanced to deal with this situation, here: http://www.sqlite.org/src/info/5526e0aa3c -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Joe, The problem is the following, I'm using and Orm Framework (ServiceStack.OrmLite namely). The query are generated, and double quoted are added automatically. There is now way to know if the query is on a View or a Table while generating the SQL. It definitely looks like a bug in SQLite to me. What do you think ? Thanks for info and help Vincent Le 14/10/12 18:26, Joe Mistachkin a écrit : Vincent DARON wrote: Does it mean that it's the expected behaviour of SQLite ? I think so, yes. Technically, the double quotes supplied in the original SELECT query were superfluous. If you remove them, they will not be present in the results. Would it be possible for System.Data.SQLite to remove these double quotes if present, as they are not required any more once you have a C# string ? Possible, yes. Likely, no. System.Data.SQLite strives to return exactly what it is given by SQLite, to the maximum extent possible. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Vincent DARON wrote: > > Does it mean that it's the expected behaviour of SQLite ? > I think so, yes. Technically, the double quotes supplied in the original SELECT query were superfluous. If you remove them, they will not be present in the results. > > Would it be possible for System.Data.SQLite to remove these double > quotes if present, as they are not required any more once you have a C# > string ? > Possible, yes. Likely, no. System.Data.SQLite strives to return exactly what it is given by SQLite, to the maximum extent possible. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Thanks Joe, Does it mean that it's the expected behaviour of SQLite ? Would it be possible for System.Data.SQLite to remove these double quotes if present, as they are not required any more once you have a C# string ? -- Vincent Le 13/10/12 17:33, Joe Mistachkin a écrit : Vincent DARON wrote: http://pastebin.com/q2m5vJky The double quotes are coming from the SQLite core native library. Run "sqlite3.exe :memory:" and execute the following commands: .mode columns .headers on CREATE TABLE TEST (id); CREATE VIEW TESTVIEW AS SELECT TEST.id FROM TEST; INSERT INTO TEST (ID) VALUES('test'); SELECT "id" FROM "TEST"; -- Observe the results here. SELECT "id" FROM "TESTVIEW"; -- Observe the results here. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Vincent DARON wrote: > > http://pastebin.com/q2m5vJky > The double quotes are coming from the SQLite core native library. Run "sqlite3.exe :memory:" and execute the following commands: .mode columns .headers on CREATE TABLE TEST (id); CREATE VIEW TESTVIEW AS SELECT TEST.id FROM TEST; INSERT INTO TEST (ID) VALUES('test'); SELECT "id" FROM "TEST"; -- Observe the results here. SELECT "id" FROM "TESTVIEW"; -- Observe the results here. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Of course http://pastebin.com/q2m5vJky Best Regards, Vincent Le 12/10/12 14:24, Joe Mistachkin a écrit : Vincent DARON wrote: It seems the IDataReader.GetName(int i) method return name surrounded by double quotes for views. Example: For a table : "Id" For a view : "\"Id\"" Is it the expected behaviour ? Do you have some example SQL and/or C# code that demonstrates this issue? -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Vincent DARON wrote: > > It seems the IDataReader.GetName(int i) method return name surrounded by > double quotes for views. > > Example: > > For a table : "Id" > For a view : "\"Id\"" > > Is it the expected behaviour ? > Do you have some example SQL and/or C# code that demonstrates this issue? -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] System.Data.SQLite Field Name are surrounded by double quotes for Views
Hi all, It seems the IDataReader.GetName(int i) method return name surrounded by double quotes for views. Example: For a table : "Id" For a view : "\"Id\"" Is it the expected behaviour ? Thanks Vincent PS: In the same way, IDataReader.GetColumnIndex() will return -1 for view column name if you do not surround them with double quotes. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users