Re: [sqlite] How to create connection life-time object?

2013-07-27 Thread Dušan Paulovič
What I need is 'install and don't care' because I use many C++ classes
as lifetime objects.
I think that my solution does work now well, but if there would be a way to
avoid use of SQL parser, it would be better.


2013/7/27 Max Vlasov <max.vla...@gmail.com>

> On Fri, Jul 26, 2013 at 9:56 PM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > Thanks for suggestion, but:
> > 1.) one object is not linked to one connection
> >
>
> If you have your own memory management, it's not a problem since the scheme
> I described is basically just a storage of pointers. To free or not to free
> (if the pointer points to a disposable entity) is your decision at your
> chosen time. But if you want automatic reference counting (so when a
> pointer not referenced anymore, it would be automatically deallocated),  I
> agree, the proposal is not good. Probably using your own global structure
> not related to sqlite is less pain.
>
>
> > 2.) object is not destroyed together with connection
> >
>
> The same, you're free to use the table just as pointers storage
>
> Max
> ___
> 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] How to create connection life-time object?

2013-07-26 Thread Dušan Paulovič
Thanks for suggestion, but:
1.) one object is not linked to one connection
2.) object is not destroyed together with connection

Dusan


2013/7/26 Max Vlasov <max.vla...@gmail.com>

> Hi, Dušan
>
>
> On Thu, Jul 25, 2013 at 2:39 PM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > Hello, is there a way to somehow set a connection life-time object?
> > ...
> >
> >
> > It would be fine to have something like:
> > int sqlite3_set_lifetime_object(
> >   sqlite3 *db,  /*db connection*/
> >   const char *zObjectName,  /*utf8 name of object*/
> >   void *pObject,/*if NULL, object is removed*/
> >   void(*xDestroy)(void*)/*destructor*/
> > );
> >
> > void * sqlite3_get_lifetime_object(
> >   sqlite3 *db,  /*db connection*/
> >   const char *zObjectName   /*utf8 name of object*/
> > );
> >
>
>
>
> How about temporary memory table just for the task of storing your objects.
>
> You initialization code for particular connection
>   Attach ':memory:' as MyObjectStorage
>   Create table MyObjectStorage.[objects] (Name Text, Ptr Text)
>
> Your code for inserting an object
>   Insert into MyObjectStorage.[objects] (Name, Ptr) VALUES ('obj1',
> '0x12345678')
>
> This code will query the pointer
>   select Ptr from MyObjectStorage.[objects] where Name='obj1'
>
> The only convention rule here will be the name of the attached db so no
> other databases (or instances of the same storage) should use this name.
>
> Max
> ___
> 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] How to create connection life-time object?

2013-07-25 Thread Dušan Paulovič
Hello, is there a way to somehow set a connection life-time object?

I mean something like:
Let's imagine you are working with some sqlite3 connection and want so
share same data with extensions, but must be guaranteed, that object gets
destroyed when connection is closed.

For now, I use creating function mechanism for it:
(pseudo - not tested code)
void return_user_data(sqlite3_context* ctxP, int argc, sqlite3_value** argv)
{
  void * ptr = sqlite3_user_data(ctxP);
  sqlite3_result_blob(ctxP, (void*), sizeof(void*));
}

int register_app_obj(sqlite3 * db)
{
  my_type *m_obj = (my_type*) sqlite3_malloc(sizeof(my_type));
  if (m_obj &&
SQLITE_OK != sqlite3_create_function_v2(
db, "app_obj", 0, SQLITE_ANY, m_obj,
return_user_data, NULL, NULL, sqlite3_free))
  {
sqlite3_free(m_obj);
m_obj = NULL;
return SQLITE_ERROR;
  }
  return SQLITE_OK;
}

Then if extension needs to get app_obj it queries "SELECT app_obj();" and
translates blob.
But this way it is too much of overhead and also there is a restriction,
that functions
can be registered only if there is no any active statement.

I have also made a complicated virtual table implementation of the same,
because
modules can be registered while statements are active, but it is much more
complicated
then such thing should be.

Do you have any idea?

It would be fine to have something like:
int sqlite3_set_lifetime_object(
  sqlite3 *db,  /*db connection*/
  const char *zObjectName,  /*utf8 name of object*/
  void *pObject,/*if NULL, object is removed*/
  void(*xDestroy)(void*)/*destructor*/
);

void * sqlite3_get_lifetime_object(
  sqlite3 *db,  /*db connection*/
  const char *zObjectName   /*utf8 name of object*/
);
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite-amalgamation32k

2013-07-24 Thread Dušan Paulovič
more about problem:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/7d991493-06f7-45f6-8f34-165b988e266c/how-can-i-debug-code-with-more-than-65535-lines


2013/7/24 Simon Slavin <slav...@bigfraud.org>

>
> On 24 Jul 2013, at 7:56am, Dušan Paulovič <paulo...@gisoft.cz> wrote:
>
> > On download page, there is available an amalgamation, where the code is
> > split into a small number of source files, such that no single source
> file
> > is longer than 32767 lines of code.
> >
> > This is good, because Visual Studio does not support more than 65535
> lines
> > of code for debugging in single file, so this version will work just
> fine.
> >
> > Could be such amalgamations available also for releases from now?
>
> 'releases' of SQLite /are/ the amalgamation files, and as far as I know,
> the SQLite team intends to continue putting out the 'short-file' version of
> the amalgamation from now on.
>
> Simon.
> ___
> 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] sqlite-amalgamation32k

2013-07-24 Thread Dušan Paulovič
Well, but these are not debuggable in Visual Studio, because sqlite3.c file
exceeds 65535 lines of code, so VS is confused and does not point on
correct line while debugging, so if I want to debug it in Visual Studio, I
must split it myself.


2013/7/24 Simon Slavin <slav...@bigfraud.org>

>
> On 24 Jul 2013, at 7:56am, Dušan Paulovič <paulo...@gisoft.cz> wrote:
>
> > On download page, there is available an amalgamation, where the code is
> > split into a small number of source files, such that no single source
> file
> > is longer than 32767 lines of code.
> >
> > This is good, because Visual Studio does not support more than 65535
> lines
> > of code for debugging in single file, so this version will work just
> fine.
> >
> > Could be such amalgamations available also for releases from now?
>
> 'releases' of SQLite /are/ the amalgamation files, and as far as I know,
> the SQLite team intends to continue putting out the 'short-file' version of
> the amalgamation from now on.
>
> Simon.
> ___
> 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] sqlite-amalgamation32k

2013-07-24 Thread Dušan Paulovič
On download page, there is available an amalgamation, where the code is
split into a small number of source files, such that no single source file
is longer than 32767 lines of code.

This is good, because Visual Studio does not support more than 65535 lines
of code for debugging in single file, so this version will work just fine.

Could be such amalgamations available also for releases from now?

Thanks
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite patch contribution

2013-07-22 Thread Dušan Paulovič
I think it is not important only for me, but for all who want to use
xBestIndex and xFilter functions and correctly solve all possible
scenarios.
Is there a way I can determine in xBestIndex/xFilter a collation sequence
used in constraints? - perhaps not.
All I found is that if I do not solve constraints on my side, engine solves
all correctly, so in my case, I do not see a problem.
But there are some opensource projects using Virtual Tables solving
contraints themselves (such as Spatialite) and it is not very easy to
explain to users, why clause WHERE column = 'ABCabc" COLLATE NOCASE does
not work, but WHERE column LIKE 'ABCabc' does.



2013/7/22 Richard Hipp <d...@sqlite.org>

> On Mon, Jul 22, 2013 at 10:27 AM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > So, in other words, there is no way for programmers from EU to contribute
> > on SQLite?
> > Is there any other option?
> > Is there a plan to solve xBestIndex collation issue?
> >
>
> Actually implementing such a patch is trivial.  We'll do that for you.  Not
> a problem.
>
> The real work comes in (1) testing the new features (2) documenting the new
> feature, and especially (3) supporting the new feature moving forward.
> These three items, and especially the third item, involve orders of
> magnitude more time and effort than actually implementing the patch.
>
> So if having the ability to use collating sequences in virtual tables is
> something that is important to you, then you have to sell the idea.  You
> have to convince the core team that your new feature is important and
> useful and ought to be supported.
>
> Submitting a "proof of concept" patch might be part of your sales pitch, as
> a way of showing that the feature is feasible and does not impact
> performance and will be easy to support.  But the patch is only a small
> part of your sales pitch.  You still need to convince the core team that
> what you are trying to do is necessary and important and will be of benefit
> to a large number of users.
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] attaching databases programmatically

2013-07-22 Thread Dušan Paulovič
Perhaps you can create new connection with multiple virtual tables reading
from all connections. But it is hard work...


2013/7/22 Nelson, Erik - 2 

> I've got an application that allows the user to create an arbitrary number
> of databases, either in memory or not.  In my C++ program, I have the
> handles and I'd like to attach them all together so the user can execute
> queries against them.  However, the only way that I've found to do that is
> to use the "ATTACH" sql.  The problem is that the sqlite3* exist, but the
> databases aren't in any namespace accessible to the "ATTACH" query.
>
> Is there some way to programmatically attach databases when all you have
> are the sqlite3 handles?
>
> I've read the list history, most of the conversations about this are a few
> years back.
>
> Thanks
>
> Erik
>
> --
> This message, and any attachments, is for the intended recipient(s) only,
> may contain information that is privileged, confidential and/or proprietary
> and subject to important terms and conditions available at
> http://www.bankofamerica.com/emaildisclaimer.   If you are not the
> intended recipient, please delete this message.
> ___
> 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] SQLite patch contribution

2013-07-22 Thread Dušan Paulovič
So, in other words, there is no way for programmers from EU to contribute
on SQLite?
Is there any other option?
Is there a plan to solve xBestIndex collation issue?


Thanks


2013/7/22 Richard Hipp 

> On Mon, Jul 22, 2013 at 9:42 AM, Adam DeVita  wrote:
>
> > Is it possible for one in a nation that doesn't permit dedication to
> > public domain to simply gift the work (and intellectual rights) to
> > someone personally, who can and will the reassign it to the public
> > domain (such as a member of the sqlite dev team)?
> >
>
> From what I understand, no.  In the EU you can not give away, disavow, or
> otherwise dispose of your moral rights.  You can enter into an agreement to
> not enforce your moral rights, but you can never do away with them.
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] SQLite patch contribution

2013-07-22 Thread Dušan Paulovič
1. I am not citizen of Czech Republic (but citizen of Slovak Republic with
similar law)
2. If I do not want apply my copyrights, I can public my code without it.


2013/7/22 Richard Hipp <d...@sqlite.org>

> On Mon, Jul 22, 2013 at 8:10 AM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > Hello, I like to make a patch for SQLite so that function xBestIndex
> gets a
> > collation sequences as a part of  sqlite3_index_info structure. Patch
> will
> > be binary compatible with previous versions, so all existing virtual
> table
> > implementations will work with new version. I understand, that I must
> > attach also public domain copyright statment to be SQLite team able to
> > merge it.
> >
>
> According to what I read in Wikipedia, citizens of the Czech Republic are
> not allowed to dedicate their work to the public domain.  :-(
>
>
>
> >
> > What I do not know is:
> > Can I somehow contact anybody about internal rules?
> >
>
> Probably the sqlite-...@sqlite.org mailing list.
>
>
> > Can I create new empty typedef for CollSeq struct? (name:
> sqlite3_coll_seq)
> > Can I create new API functions? (sqlite3_coll_seq_strcmp,
> > sqlite3_coll_seq_name, sqlite3_coll_seq_enc)
> > What all documentation should I provide? (I am not english native
> speaker)
> > Should be such code in #ifndef SQLITE_OMIT_VIRTUALTABLE blocks?
> > Is there any chance that such patch will be merged to SQLite?
> >
>
> It is an up-hill battle.  New interfaces in SQLite must be supported
> forever, which is a lot of work for the core team.  So in order to accept a
> new interface, we need to be convinced that there is lasting value for a
> large community of users and that this value is sufficient to justify the
> long-term support costs.  Other obstacles include the copyright issue cited
> above, and the necessity of having 100% branch test coverage and complete
> documentation of the new features.
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] SQLite patch contribution

2013-07-22 Thread Dušan Paulovič
Hello, I like to make a patch for SQLite so that function xBestIndex gets a
collation sequences as a part of  sqlite3_index_info structure. Patch will
be binary compatible with previous versions, so all existing virtual table
implementations will work with new version. I understand, that I must
attach also public domain copyright statment to be SQLite team able to
merge it.

What I do not know is:
Can I somehow contact anybody about internal rules?
Can I create new empty typedef for CollSeq struct? (name: sqlite3_coll_seq)
Can I create new API functions? (sqlite3_coll_seq_strcmp,
sqlite3_coll_seq_name, sqlite3_coll_seq_enc)
What all documentation should I provide? (I am not english native speaker)
Should be such code in #ifndef SQLITE_OMIT_VIRTUALTABLE blocks?
Is there any chance that such patch will be merged to SQLite?

Thanks.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
OK, I have looked over all possible solutions for this issue and the best I
could find is to extend sqlite3_index_info structure as follows:
struct sqlite3_index_info {

  ...

  /* Extra info */
  struct sqlite3_index_extras {
int iVersion;
sqlite3_collseq **coll_seq;  /* Collation sequences (same size as
aConstraints) */
  } *extras;
};

this would be binary compatible and also extendable for needs in future.

How about this?


2013/7/17 Dan Kennedy <danielk1...@gmail.com>

> On 07/17/2013 03:46 PM, Dušan Paulovič wrote:
>
>> Hello,
>> in virtual table mechanism is missing a way to correctly handle following
>> queries:
>>
>> SELECT * FROM vtab WHERE field = 'abc' COLLATE NOCASE;
>> SELECT * FROM vtab WHERE field = 'abc' COLLATE USER_COLLATE;
>>
>> To xBestIndex function is passed only constraint field = 'abc', but there
>> is no way to correctly compare (by correctly I mean accordingly to passed
>> collation) those strings because of missing collation functions in
>> constraint definition.
>>
>> Patch for this issue exists for a long time:
>> http://osdir.com/ml/sqlite-**users/2011-09/msg00152.html<http://osdir.com/ml/sqlite-users/2011-09/msg00152.html>
>>
>> Is there any chance that it could get merged?
>>
>
> I think the main problem is that it is not binary compatible.
>
> Dan.
>
>
>
> __**_
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<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] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
Yes, xRename was a part of the v1 module interface, but v1 module interface
is not the first verson of it.
Old sqlite extensions does not even contain xRename in their VT
implementations and xFindFunction was the last one considered.

I understand what you mean by binary incompatibility, but it is not a
reason to keep this issue unresolved.
Without possibility to custom handling of collation in xBestIndex function
is this great idea limited to be used only in case of numeric queries.
Now it is no way to return correct results from VT using xBestIndex. Yes, I
can keep these constraints on SQLite, but then perhaps these
constraints should be filtered out from xBestIndex consideration.

Perhaps new function returning CollSeq array for constraint structure in
API could resolve it - as I suggested in previous post.
It can be resolved even with binary compatibility.

Dusan


2013/7/17 Jay A. Kreibich 

> On Wed, Jul 17, 2013 at 01:27:20PM +0200, Du?an Paulovi? scratched on the
> wall:
> > But it is the same as with new functions in sqlite3_module. Old SQLite
> > extensions does not implement xRename function which is now needed. Also,
> > new feature could be made optional using macro switch like some other
> > features in SQLite.
>
>   Actually, xRename() was part of the v1 module interface.  xSavepoint(),
>   xRelease(), and xRollbackTo() were added in the v2 interface.  All
>   three of these functions are optional, and the fact they were added
>   at the end of the data structure means a v1 module will run under a
>   modern version of SQLite just fine.
>
>   http://www.sqlite.org/c3ref/module.html
>
>-j
>
> --
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "Intelligence is like underwear: it is important that you have it,
>  but showing it to the wrong people has the tendency to make them
>  feel uncomfortable." -- Angela Johnson
> ___
> 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] Sqlite locking issue with ATTACH'ed databases

2013-07-17 Thread Dušan Paulovič
If you remove a busy check, does it output any statements?
Do you have any custom functions/operations running so they could block
sqlite in creating new statement?


2013/7/17 Loren Keagle 

> Hi everyone,
>
> I have an interesting locking problem that I'm wondering if someone can
> help with some insight.
>
> I have a master database with some metadata, and several sub-databases to
> store logging events. I have one reader object and one writer object that
> attach to the sub-databases and encapsulate the read/write operations
> respectively.
>
> I've found a very unexpected locking behavior with the attached databases
> and exclusive transactions. One of my unit tests does the following:
>
> Begin EXCLUSIVE TRANSACTION;
> insert several rows of data;
> Commit transaction;
>
> Prepare query statement;
> Iterate through one or more rows;
> Reset statement;
>
> Attempt to begin transaction; <--- SQLITE_BUSY
> Would like to write more here, but can't unless I close/open the
> connection;
>
> I can't seem to figure out any reason why I can't create a new exclusive
> transaction here, and I feel it must have to do with the fact that I have
> attached to sub-databases (possibly the same sub-database) with my
> reader/writer objects. This is single threaded and only database connection
> (with attach/detach logic).
> I have verified that all statements prepared by the connection are
> properly reset - this is handled by my C++ wrappers, and any errors will
> throw an exception. I even iterated through all of the current statements
> with the following code immediately before my transaction failure, with no
> results:
>
> sqlite3_stmt *stmt = NULL;
> while ((stmt = sqlite3_next_stmt(db, stmt)) != NULL)
> {
> if (sqlite3_stmt_busy(stmt))
> {
> const char* sql = sqlite3_sql(stmt);
> std::cout << sql << "\r\n";
> }
> }
>
> Can anyone think of a reason why attached databases would prevent entering
> a second transaction? BTW, it doesn't seem to work with immediate
> transactions either. If I remove the query, everything works fine.
>
> Thanks!
>
>
> 
> This email, including any attachments and files transmitted with it, are
> for the sole use of the intended recipient(s) to whom this email is
> addressed, and may contain confidential and/or privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please be advised that you have received
> this email in error, and please contact the sender by reply email and
> destroy all copies (including all electronic and hard copies) of the
> original message. Thank you.
> ___
> 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] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
Well, to make it binary compatible with existing virtual table
implementations, there could be added new function returning const pointer
to CollSeq structure from passed index contraint.
This function should be callable only from xBestIndex function.

Something like:
const CollSeq * sqlite3_vtab_constraint_coll_seq(const
sqlite3_index_constraint* pConstraint);

sqlite3_index_constraint contains iTermOffset, so to find a collation
sequence for it should not be so big problem.

How about it?


2013/7/17 Dušan Paulovič <paulo...@gisoft.cz>

> But it is the same as with new functions in sqlite3_module. Old SQLite
> extensions does not implement xRename function which is now needed. Also,
> new feature could be made optional using macro switch like some other
> features in SQLite.
>
>
> 2013/7/17 Stephan Beal <sgb...@googlemail.com>
>
>> On Wed, Jul 17, 2013 at 12:24 PM, Dušan Paulovič <paulo...@gisoft.cz>
>> wrote:
>>
>> > What do you mean? I use it for a while on Windows and all works.
>> > Binary not compatible with what?
>> >
>>
>> What Dan means is that libraries built with and without this feature might
>> not be binary compatible. i compile against an sqlite3 DLL without this
>> feature, then my sysadmin updates libsqlite3 to one with this feature, and
>> my binary will then likely segfault at some point (or otherwise invoke
>> undefined behaviour) because the binary signatures of the sqlite
>> structures
>> in my app no longer match those in the library. A recompile of my app
>> (with
>> no code changes) would be necessary to fix this.
>>
>> --
>> - stephan beal
>> http://wanderinghorse.net/home/stephan/
>> http://gplus.to/sgbeal
>> ___
>> 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] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
But it is the same as with new functions in sqlite3_module. Old SQLite
extensions does not implement xRename function which is now needed. Also,
new feature could be made optional using macro switch like some other
features in SQLite.


2013/7/17 Stephan Beal <sgb...@googlemail.com>

> On Wed, Jul 17, 2013 at 12:24 PM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > What do you mean? I use it for a while on Windows and all works.
> > Binary not compatible with what?
> >
>
> What Dan means is that libraries built with and without this feature might
> not be binary compatible. i compile against an sqlite3 DLL without this
> feature, then my sysadmin updates libsqlite3 to one with this feature, and
> my binary will then likely segfault at some point (or otherwise invoke
> undefined behaviour) because the binary signatures of the sqlite structures
> in my app no longer match those in the library. A recompile of my app (with
> no code changes) would be necessary to fix this.
>
> --
> - stephan beal
> http://wanderinghorse.net/home/stephan/
> http://gplus.to/sgbeal
> ___
> 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] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
What do you mean? I use it for a while on Windows and all works.
Binary not compatible with what?

Dusan


2013/7/17 Dan Kennedy <danielk1...@gmail.com>

> On 07/17/2013 03:46 PM, Dušan Paulovič wrote:
>
>> Hello,
>> in virtual table mechanism is missing a way to correctly handle following
>> queries:
>>
>> SELECT * FROM vtab WHERE field = 'abc' COLLATE NOCASE;
>> SELECT * FROM vtab WHERE field = 'abc' COLLATE USER_COLLATE;
>>
>> To xBestIndex function is passed only constraint field = 'abc', but there
>> is no way to correctly compare (by correctly I mean accordingly to passed
>> collation) those strings because of missing collation functions in
>> constraint definition.
>>
>> Patch for this issue exists for a long time:
>> http://osdir.com/ml/sqlite-**users/2011-09/msg00152.html<http://osdir.com/ml/sqlite-users/2011-09/msg00152.html>
>>
>> Is there any chance that it could get merged?
>>
>
> I think the main problem is that it is not binary compatible.
>
> Dan.
>
>
>
> __**_
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-**bin/mailman/listinfo/sqlite-**users<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] Passing collation to xBestIndex

2013-07-17 Thread Dušan Paulovič
Hello,
in virtual table mechanism is missing a way to correctly handle following
queries:

SELECT * FROM vtab WHERE field = 'abc' COLLATE NOCASE;
SELECT * FROM vtab WHERE field = 'abc' COLLATE USER_COLLATE;

To xBestIndex function is passed only constraint field = 'abc', but there
is no way to correctly compare (by correctly I mean accordingly to passed
collation) those strings because of missing collation functions in
constraint definition.

Patch for this issue exists for a long time:
http://osdir.com/ml/sqlite-users/2011-09/msg00152.html

Is there any chance that it could get merged?

Dusan
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3_auto_extension - unloaded DLL issue

2013-07-15 Thread Dušan Paulovič
Thank you MR. Hipp...

Dušan



2013/7/15 Richard Hipp <d...@sqlite.org>

> On Sat, Jul 13, 2013 at 5:14 AM, Dušan Paulovič <paulo...@gisoft.cz>
> wrote:
>
> > Hello,
> > we are currently facing problem with Access violation exception caused by
> > function sqlite3_open_v2 trying to load extensions from unloaded DLLs.
> >
>
> New interface added: sqlite3_cancel_auto_extension(X).  You can use this to
> cancel prior calls to sqlite3_auto_extension() before unloading the DLL.
>
> http://www.sqlite.org/draft/c3ref/cancel_auto_extension.html
>
> Download snapshots containing this change from
>
> http://www.sqlite.org/draft/download.html
>
>
>
> >
> > How it happens:
> > - There are 2 (or more) plugin DLLs in main application which are linked
> to
> > SQLite.
> > - These plugins can be loaded and uloaded by user.
> > - Main application itself does not use SQLite, so each plugin using
> SQLite
> > must be linked to it.
> > - When any plugin is loaded, it registers its entry point using interface
> > sqlite3_auto_extension.
> > - So when 2 (or more) plugins are loaded, each registers its entry
> point(s)
> > to the same SQLite module instance.
> > - When one of these plugins is going to be unloaded by user, it can not
> use
> > sqlite3_reset_auto_extension,
> >   because that would uninstall also all entry points of another plugins.
> >   So it happens, that SQlite holds entry point(s) to DLL which is
> unloaded.
> > - Now, if user executes any command from remaining DLL, it invokes
> > sqlite3_open_v2,
> >   SQLite invokes all registered entry points including those pointing to
> > released memory,
> >   so system raises Access Viloation exception.
> >
> > Possible solution of this issue would be a way to 'uninstall' entry
> point.
> > something like:
> > int sqlite3_remove_auto_extension(void (*xEntryPoint)(void));
> >
> > Also it would be fine to be able to load static extensions to separate
> > connections:
> > something like:
> > int sqlite3_load_static_extension(sqlite3 *db, void
> (*xEntryPoint)(void));
> >
> > If you would need any additional information about issue,
> > please contact me at: paulo...@gisoft.cz
> >
> > Additional info:
> > SQLite Version: 3.7.14.1, Source ID: 2012-10-04 19:37:12
> > 091570e46d04e84b67228e0bdbcd6e1fb60c6bdb
> >
> > Perhaps irrelevant in this case:
> > OS: Windows Vista
> > Main Application: Bentley MicroStation V8i
> > Plugins: MDL (MicroStation Development Library)
> >
> > Regards,
> > Dusan Paulovic
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> 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] sqlite3_auto_extension - unloaded DLL issue

2013-07-13 Thread Dušan Paulovič
Hello,
we are currently facing problem with Access violation exception caused by
function sqlite3_open_v2 trying to load extensions from unloaded DLLs.

How it happens:
- There are 2 (or more) plugin DLLs in main application which are linked to
SQLite.
- These plugins can be loaded and uloaded by user.
- Main application itself does not use SQLite, so each plugin using SQLite
must be linked to it.
- When any plugin is loaded, it registers its entry point using interface
sqlite3_auto_extension.
- So when 2 (or more) plugins are loaded, each registers its entry point(s)
to the same SQLite module instance.
- When one of these plugins is going to be unloaded by user, it can not use
sqlite3_reset_auto_extension,
  because that would uninstall also all entry points of another plugins.
  So it happens, that SQlite holds entry point(s) to DLL which is unloaded.
- Now, if user executes any command from remaining DLL, it invokes
sqlite3_open_v2,
  SQLite invokes all registered entry points including those pointing to
released memory,
  so system raises Access Viloation exception.

Possible solution of this issue would be a way to 'uninstall' entry point.
something like:
int sqlite3_remove_auto_extension(void (*xEntryPoint)(void));

Also it would be fine to be able to load static extensions to separate
connections:
something like:
int sqlite3_load_static_extension(sqlite3 *db, void (*xEntryPoint)(void));

If you would need any additional information about issue,
please contact me at: paulo...@gisoft.cz

Additional info:
SQLite Version: 3.7.14.1, Source ID: 2012-10-04 19:37:12
091570e46d04e84b67228e0bdbcd6e1fb60c6bdb

Perhaps irrelevant in this case:
OS: Windows Vista
Main Application: Bentley MicroStation V8i
Plugins: MDL (MicroStation Development Library)

Regards,
Dusan Paulovic
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users