Views containing custom SQL functions
jgodfrey - Wto Sie 07, 2007 4:08 pm
" />I have some views containing custom (Tcl-based) functions. When I try to access those views from within SQLiteStudio, the application complains.
While that's expected (after all, the custom functions aren't available), the specific errors that are generated are (I think) incorrect.
For instance, I have a view defined as follows:
Kod:CREATE VIEW postdata AS SELECT p.name as name, t.tx AS tx, t.ty AS ty, t.tz AS tz, p.tx AS px, p.ty AS py, p.tz AS pz, p.tx - t.tx AS i, p.ty - t.ty AS j, p.tz - t.tz AS k, sql_pow(sql_pow(t.tx-p.tx,2) + sql_pow(t.ty-p.ty,2) + sql_pow(t.tz-p.tz,2),0.5) AS mag FROM postpart as p INNER JOIN posttool as t ON (t.name = p.name) ORDER BY p.name
Note, there are several references to a custom function named "sql_pow". When I try to access the above view in SQLiteStudio, I receive the following error:
Kod:Error while executing query: no such column: p.name
I'd expect the error to more about the missing function than the column name, right?
Thanks,
Jeff
Googie - Wto Sie 07, 2007 4:26 pm
" />Have you tried to 'select * from view_name' from some very simple Tcl script? Like:Kod:package require sqlite3 sqlite3 db database.db db eval {select * from view_name} db close This should throw exactly same error, because this is error returned by SQLite engine and not by SQLiteStudio. SQLiteStudio just catches SQLite errors and shows them in Status field on the bottom.
jgodfrey - Wto Sie 07, 2007 4:41 pm
" /> ">Have you tried to 'select * from view_name' from some very simple Tcl script? Like:Kod:package require sqlite3 sqlite3 db database.db db eval {select * from view_name} db close This should throw exactly same error, because this is error returned by SQLite engine and not by SQLiteStudio. SQLiteStudio just catches SQLite errors and shows them in Status field on the bottom.
Googie,
Understood, but that doesn't seem to be the case. I just tried that in a Wish console. The returned error, as expected, is:
Kod:no such function: sql_pow
Also, that's the exact error that's returned by a few other SQLite tools when I access this particular view.
Jeff
Googie - Wto Sie 07, 2007 6:59 pm
" />Ok, I'll take a look at it. Thanks!
Googie - Nie Wrz 09, 2007 2:22 pm
" />I'm working on this one right now. I tried to repeat it and I get error: ">Error while executing query: no such function: sql_powso it looks ok. Maybe it depends on SQLite engine version?
zanotowane.pldoc.pisz.plpdf.pisz.plprzeloty.htw.pl
|