Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function
> I'm assuming this is not a regular pattern that has an idiomatic workaround? You are correct. With SQLite the only option you have is to call your user-defined function directly from your host language. Pavel On Thu, Jul 7, 2011 at 12:43 PM, Ben Harper wrote: > OK. > > I'm assuming this is not a regular pattern that has an idiomatic workaround? > > Ben > > -Original Message- > From: sqlite-users-boun...@sqlite.org > [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov > Sent: 07 July 2011 05:18 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined > function > >> Is there something special one needs to do in order to drop a table from >> inside a user-defined function? >> >> To test, I call it simply like so: >> SELECT my_function(); > > It shouldn't be ever possible to change the database from within a > function called from SELECT statement. SELECT query doesn't ever > changes any data. > > > Pavel > > > On Thu, Jul 7, 2011 at 10:38 AM, Ben Harper wrote: >> I have a user-defined function that I register with create_function. >> >> Inside my function I try to drop an r-tree virtual table, but I get the >> error SQLITE_LOCKED. >> >> Is there something special one needs to do in order to drop a table from >> inside a user-defined function? >> >> To test, I call it simply like so: >> SELECT my_function(); >> >> Thanks, >> Ben >> ___ >> 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 > > > ___ > 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] DROP TABLE yields SQLITE_LOCKED from user-defined function
On 7/7/2011 10:38 AM, Ben Harper wrote: > I have a user-defined function that I register with create_function. > > Inside my function I try to drop an r-tree virtual table, but I get the error > SQLITE_LOCKED. > > Is there something special one needs to do in order to drop a table from > inside a user-defined function? You can't change the database schema, from a user-defined function or otherwise, as long as there's any SELECT, INSERT, UPDATE or DELETE statement still in progress (one on which step was called but reset or finalize wasn't). Corollary: there's no way to drop a table from a user-defined function. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function
OK. I'm assuming this is not a regular pattern that has an idiomatic workaround? Ben -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov Sent: 07 July 2011 05:18 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function > Is there something special one needs to do in order to drop a table from > inside a user-defined function? > > To test, I call it simply like so: > SELECT my_function(); It shouldn't be ever possible to change the database from within a function called from SELECT statement. SELECT query doesn't ever changes any data. Pavel On Thu, Jul 7, 2011 at 10:38 AM, Ben Harper wrote: > I have a user-defined function that I register with create_function. > > Inside my function I try to drop an r-tree virtual table, but I get the error > SQLITE_LOCKED. > > Is there something special one needs to do in order to drop a table from > inside a user-defined function? > > To test, I call it simply like so: > SELECT my_function(); > > Thanks, > Ben > ___ > 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function
> Is there something special one needs to do in order to drop a table from > inside a user-defined function? > > To test, I call it simply like so: > SELECT my_function(); It shouldn't be ever possible to change the database from within a function called from SELECT statement. SELECT query doesn't ever changes any data. Pavel On Thu, Jul 7, 2011 at 10:38 AM, Ben Harper wrote: > I have a user-defined function that I register with create_function. > > Inside my function I try to drop an r-tree virtual table, but I get the error > SQLITE_LOCKED. > > Is there something special one needs to do in order to drop a table from > inside a user-defined function? > > To test, I call it simply like so: > SELECT my_function(); > > Thanks, > Ben > ___ > 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
[sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function
I have a user-defined function that I register with create_function. Inside my function I try to drop an r-tree virtual table, but I get the error SQLITE_LOCKED. Is there something special one needs to do in order to drop a table from inside a user-defined function? To test, I call it simply like so: SELECT my_function(); Thanks, Ben ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users