Re: [sqlite] List of active savepoints names

2009-09-22 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Lukas Gebauer wrote:
> You must be very unhappy about current existence of 
> sqlite3_get_autocommit function, right? You said, by the way: "It is 
> not needed, if you organize your code well." :D It is the same case!

Personally I don't use it since error conditions are handled by exceptions
(the benefit of not using C :-)

> Question is: 
> Users can ask SQLite for transaction state. But they cannot ask for 
> transaction name? First is useful and many users needs it, and second 
> not? I am surprised. 

It is transaction names and they are both a list and a tree.  And no
existing code produces a tree-list of the names, and you are the only one to
ever ask for them.

> But never mind, I register your response "no"! Forget it, sorry for 
> my bothering.

I am not a member of the project nor do I speak on its behalf.  I am merely
trying to help you understand what happens with requests in open source
projects and SQLite in particular based on several years of history.  You
can file a feature request at http://www.sqlite.org/src/tktnew but it will
be very low priority, especially since utility to other developers has not
been demonstrated.

At no point have you been prevented from writing your own routine.  If you
want other people to do the work then you need to convince them.  And for
the record I did provide you with a function that would provide the
information in a debugging context.  You could even translate the code into
something a capable debugger like gdb could use.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkq4j7QACgkQmOOfHg372QSR6QCfa2GwUyYzYh5npjqhOmNF5gE3
4Q8An2pZDrDNPrnortRAfzOagIl3JWez
=rdE9
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] List of active savepoints names

2009-09-22 Thread Dan Kennedy

On Sep 22, 2009, at 2:38 PM, Lukas Gebauer wrote:

>> A simple rule of thumb is to look at how useful features would be to
>> other SQLite users.  Note that you are the only one to have asked for
>> this feature and not one other person has agreed with you on its  
>> need!
>> The responses have generally been along the lines of suggesting you
>> organize your code so that you do not need it.  But even if it was
>> added as a debugging aid, do you expect people to compile up two
>> versions of SQLite - one with debugging aids on and another with them
>> off?  This feature would impose decisions like that on others in
>> addition to the future maintenance costs.
>
> You must be very unhappy about current existence of
> sqlite3_get_autocommit function, right? You said, by the way: "It is
> not needed, if you organize your code well." :D It is the same case!

Obscure fact: Sometimes out-of-memory or IO errors can force SQLite to
rollback an active transaction. And sometimes not. Depends on exactly
where the error strikes. So some particularly fault-resistant  
applications
use sqlite3_get_autocommit() to determine exactly what happened after
one of these errors occurs.

Dan.


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


Re: [sqlite] List of active savepoints names

2009-09-22 Thread Lukas Gebauer
> A simple rule of thumb is to look at how useful features would be to
> other SQLite users.  Note that you are the only one to have asked for
> this feature and not one other person has agreed with you on its need!
>  The responses have generally been along the lines of suggesting you
> organize your code so that you do not need it.  But even if it was
> added as a debugging aid, do you expect people to compile up two
> versions of SQLite - one with debugging aids on and another with them
> off?  This feature would impose decisions like that on others in
> addition to the future maintenance costs.

You must be very unhappy about current existence of 
sqlite3_get_autocommit function, right? You said, by the way: "It is 
not needed, if you organize your code well." :D It is the same case!

Question is: 
Users can ask SQLite for transaction state. But they cannot ask for 
transaction name? First is useful and many users needs it, and second 
not? I am surprised. 

But never mind, I register your response "no"! Forget it, sorry for 
my bothering.



-- 
Lukas Gebauer.

E-mail: gebau...@mlp.cz
http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.

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


Re: [sqlite] List of active savepoints names

2009-09-21 Thread Jim Showalter
I half get his point--if it's hard to program, then only
really good programmers will do it.

But that argument has been made against every advance in software
development since the profession began. Patchcord-pluggers made fun of
switch-flippers. Switch-flippers made fun of microcoders. Microcoders
made fun of assembly-language programmers. Assembly-language
programmers made fun of high-level-language programmers.
High-level-language programmers made fun of modelers. And everyone
makes fun of ruby programmers.

But this argument is basically bullshit, because it misses a key
truth: software has improved in power, usability, and ubiquity. When
only a handful of people could program a computer, then only a handful
of useful things were doable with computers. Was that desirable? Or is
it better that we have zillions of powerful applications written by
all manner of programmers available all over the place? If the masses
can program, then you get masses of programs, and you can let market
forces weed out the bad ones.

Linus' argument basically boils down to real men don't use numerically
controlled machine tools. Back when men were men, they built cars by
hand, the way god intended cars to be built. The way his grandpappy
made cars, dammit, snarls manly Linus as he rocks on his porch,
whittlin' and spittin' chaw.

- Original Message - 
From: "Roger Binns" <rog...@rogerbinns.com>
To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
Sent: Monday, September 21, 2009 10:42 AM
Subject: Re: [sqlite] List of active savepoints names


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Lukas Gebauer wrote:
>> I am not creating and releasing savepoints!
>
> Yes you are.  The SQLite library is not magically doing them on a 
> whim.
> Your code is asking for them.
>
>>> You can create a custom wrapper for savepoints which may have
>>> the stack of calls.
>>
>> Why I must duplicate code what is inside Sqlite too?
>
> There is no code inside SQLite that returns the list of savepoints 
> so there
> is nothing to duplicate.  There is a data structure of savepoints.
>
> Adding this code and API seems simple enough and superficially it 
> is.
> However once added it cannot be removed (dynamic linking would 
> break), has
> to be documented and tested, and adds some bloat to SQLite.  It 
> would also
> constrain future changes to underlying data structures.  For example 
> if the
> public API returns a flat list, it would complicate things if the 
> internal
> data structure would be better off as a tree.
>
> Although it may not seem like it, one of the most important jobs of 
> project
> maintainers is saying "no".  Here is Linus Torvalds on the subject:
>
> http://linuxmafia.com/faq/Kernel/linus-im-a-bastard-speech.html
>
>> Sqlite have savepoint stack inside (AFAIK). I really not know why 
>> is
>> a problem to list this stack through some API. (But maybe it really
>> is a problem, I don't know, but nobody tell this yet...)
>
> This code will print out the names to stderr.  You should be able to 
> do the
> equivalent from your debugger.
>
> void print_savepoints(sqlite3 *db)
> {
>  int i;
>  for(i=0;inSavepoint;i++)
>fprintf(stderr, "%s\n", db->pSavepoint[i]->zName);
> }
>
> They are also in a tree like structure so it isn't quite that 
> simple.
>
>> Yes, I can create my own wrapper, what can work with my code only,
>
> It is your code that needs debugging :-)
>
>> Just because I must duplicate
>> lot of code for decide if savepoint is or not is created,
>
> If you have random code generating random SQL then it is harder, but 
> that is
> a bad design anyway.  Generally you'll have a function that when 
> called
> generates savepoints and another for rolling them back.  But even 
> with
> random code, the authorizer interface can tell you when savepoint 
> SQL is
> prepared.
>
>> And now compare it with simple API funtion what just list existing
>> savepoint stack inside Sqlite. It is simple, trivial, useful... and
>> working right at any case.
>
> And constrains data structures, requires documentation and testing, 
> can
> never be removed and adds bloat.  And in most cases still isn't 
> useful by
> itself - you would still need to add yet another wrapper around that
> function depending on what you want to happen (print it indented as 
> a tree,
> convert to utf16 or ascii, combine names separated by commas, stdout 
> or
> stderr, gui dialog etc).
>
>> This is why I am asking for. Thanks!
>
> A simple rule of thumb is to look at how useful features would be to 
> other
> SQLite users.  Note that you 

Re: [sqlite] List of active savepoints names

2009-09-21 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Lukas Gebauer wrote:
> I am not creating and releasing savepoints! 

Yes you are.  The SQLite library is not magically doing them on a whim.
Your code is asking for them.

>> You can create a custom wrapper for savepoints which may have 
>> the stack of calls.
> 
> Why I must duplicate code what is inside Sqlite too?

There is no code inside SQLite that returns the list of savepoints so there
is nothing to duplicate.  There is a data structure of savepoints.

Adding this code and API seems simple enough and superficially it is.
However once added it cannot be removed (dynamic linking would break), has
to be documented and tested, and adds some bloat to SQLite.  It would also
constrain future changes to underlying data structures.  For example if the
public API returns a flat list, it would complicate things if the internal
data structure would be better off as a tree.

Although it may not seem like it, one of the most important jobs of project
maintainers is saying "no".  Here is Linus Torvalds on the subject:

 http://linuxmafia.com/faq/Kernel/linus-im-a-bastard-speech.html

> Sqlite have savepoint stack inside (AFAIK). I really not know why is 
> a problem to list this stack through some API. (But maybe it really 
> is a problem, I don't know, but nobody tell this yet...)

This code will print out the names to stderr.  You should be able to do the
equivalent from your debugger.

void print_savepoints(sqlite3 *db)
{
  int i;
  for(i=0;inSavepoint;i++)
fprintf(stderr, "%s\n", db->pSavepoint[i]->zName);
}

They are also in a tree like structure so it isn't quite that simple.

> Yes, I can create my own wrapper, what can work with my code only, 

It is your code that needs debugging :-)

> Just because I must duplicate 
> lot of code for decide if savepoint is or not is created,

If you have random code generating random SQL then it is harder, but that is
a bad design anyway.  Generally you'll have a function that when called
generates savepoints and another for rolling them back.  But even with
random code, the authorizer interface can tell you when savepoint SQL is
prepared.

> And now compare it with simple API funtion what just list existing 
> savepoint stack inside Sqlite. It is simple, trivial, useful... and 
> working right at any case. 

And constrains data structures, requires documentation and testing, can
never be removed and adds bloat.  And in most cases still isn't useful by
itself - you would still need to add yet another wrapper around that
function depending on what you want to happen (print it indented as a tree,
convert to utf16 or ascii, combine names separated by commas, stdout or
stderr, gui dialog etc).

> This is why I am asking for. Thanks!

A simple rule of thumb is to look at how useful features would be to other
SQLite users.  Note that you are the only one to have asked for this feature
and not one other person has agreed with you on its need!  The responses
have generally been along the lines of suggesting you organize your code so
that you do not need it.  But even if it was added as a debugging aid, do
you expect people to compile up two versions of SQLite - one with debugging
aids on and another with them off?  This feature would impose decisions like
that on others in addition to the future maintenance costs.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkq3uvIACgkQmOOfHg372QQI/QCcDDg5dthEmqBJj+FZL5NhatN2
JusAoMSHlyXRJsLHMhCF+S3vQgKFUX7E
=+RxM
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] List of active savepoints names

2009-09-21 Thread Pavel Ivanov
> And now compare it with simple API funtion what just list existing
> savepoint stack inside Sqlite. It is simple, trivial, useful... and
> working right at any case.

So, just take SQLite code, implement this trivial function and use it
as you like. It will be a separate function, you will not change any
existing code, so you will not have any problems merging your patch
into sources of any future SQLite release.

Pavel

On Mon, Sep 21, 2009 at 6:51 AM, Lukas Gebauer  wrote:
>> > > > I am searching some API function for get list of active
>> > > > savepoint names. Is this possible? Thank you!
>
>> > > No, this is not possible. Why do you need it in the first place?
>
>> > It will be great for debugging, for example.
>
>> You can create a custom wrapper for savepoints which may have
>> the stack of calls.
>
> Why I must duplicate code what is inside Sqlite too? Ad-absurdum - it
> is like you suggest me to implement my own Sqlite clone. *grin*
>
> Sqlite have savepoint stack inside (AFAIK). I really not know why is
> a problem to list this stack through some API. (But maybe it really
> is a problem, I don't know, but nobody tell this yet...)
>
> Yes, I can create my own wrapper, what can work with my code only,
> however with third-party code not. I can catch all savepoint and
> transaction commands and try to simulate what happen inside Sqlite.
> Maybe I made same decision as Sqlite. With each Sqlite version I must
> check, if handling in Sqlite was not changed. Etc. Well, I not see
> this as effective and reliable solution anymore.
>
> And now compare it with simple API funtion what just list existing
> savepoint stack inside Sqlite. It is simple, trivial, useful... and
> working right at any case.
>
> This is why I am asking for. Thanks!
>
>
>
> --
> Lukas Gebauer.
>
> E-mail: gebau...@mlp.cz
> http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.
>
> ___
> 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] List of active savepoints names

2009-09-21 Thread Lukas Gebauer
> > > > I am searching some API function for get list of active
> > > > savepoint names. Is this possible? Thank you!

> > > No, this is not possible. Why do you need it in the first place?

> > It will be great for debugging, for example.

> You can create a custom wrapper for savepoints which may have 
> the stack of calls.

Why I must duplicate code what is inside Sqlite too? Ad-absurdum - it 
is like you suggest me to implement my own Sqlite clone. *grin*

Sqlite have savepoint stack inside (AFAIK). I really not know why is 
a problem to list this stack through some API. (But maybe it really 
is a problem, I don't know, but nobody tell this yet...)

Yes, I can create my own wrapper, what can work with my code only, 
however with third-party code not. I can catch all savepoint and 
transaction commands and try to simulate what happen inside Sqlite. 
Maybe I made same decision as Sqlite. With each Sqlite version I must 
check, if handling in Sqlite was not changed. Etc. Well, I not see 
this as effective and reliable solution anymore.

And now compare it with simple API funtion what just list existing 
savepoint stack inside Sqlite. It is simple, trivial, useful... and 
working right at any case. 

This is why I am asking for. Thanks!



-- 
Lukas Gebauer.

E-mail: gebau...@mlp.cz
http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.

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


Re: [sqlite] List of active savepoints names

2009-09-21 Thread Alexey Pechnikov
Hello!

On Monday 21 September 2009 11:48:37 Lukas Gebauer wrote:
> > > I am searching some API function for get list of active savepoint
> > > names. Is this possible? Thank you!
> > 
> > No, this is not possible. Why do you need it in the first place?
> 
> It will be great for debugging, for example.
> 

You can create a custom wrapper for savepoints which may have 
the stack of calls.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] List of active savepoints names

2009-09-21 Thread Lukas Gebauer
> > I am searching some API function for get list of active savepoint
> > names. Is this possible? Thank you!
> 
> No, this is not possible. Why do you need it in the first place?

It will be great for debugging, for example.



-- 
Lukas Gebauer.

E-mail: gebau...@mlp.cz
http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.

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


Re: [sqlite] List of active savepoints names

2009-09-21 Thread Lukas Gebauer
> > I am searching some API function for get list of active savepoint
> > names. Is this possible? Thank you!
> 
> Since your code is creating and releasing savepoints, why not just
> record them in your code?

I am not creating and releasing savepoints! They are created and 
released by Sqlite, I just calling commands. ;-) So, Sqlite must know 
what savepoints exists at any time. Would be easy allow to read this 
set of savepoint names, AFAIK.

Doing it in my code is little silly. Just because I must duplicate 
lot of code for decide if savepoint is or not is created, if is or 
not is released, etc. Additionally, when my application callign some 
third-party code for accessing sqlite, then I cannot do this easily.

However list of active savepoints would be great for debugging, for 
enhanced debug info for exception dialogs, etc.

> Also IIRC you can also have duplicate names.

Never mind. It not break anything. When I got list of savepoints 
names sorted in same order as is inside SQlite, then I got exactly 
what I need.



-- 
Lukas Gebauer.

E-mail: gebau...@mlp.cz
http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.

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


Re: [sqlite] List of active savepoints names

2009-09-18 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Lukas Gebauer wrote:
> I am searching some API function for get list of active savepoint 
> names. Is this possible? Thank you!

Since your code is creating and releasing savepoints, why not just
record them in your code?  Also IIRC you can also have duplicate names.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqzkggACgkQmOOfHg372QQfuACgpNEzkhdLLDnRw5HNGEpAH6Am
tIUAnjnlBEaD6V72b91QALN4L4oRwjfv
=O3HE
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] List of active savepoints names

2009-09-18 Thread Pavel Ivanov
> I am searching some API function for get list of active savepoint
> names. Is this possible? Thank you!

No, this is not possible. Why do you need it in the first place?

Pavel

On Fri, Sep 18, 2009 at 5:55 AM, Lukas Gebauer  wrote:
>
> Hello all!
>
> I am searching some API function for get list of active savepoint
> names. Is this possible? Thank you!
>
>
>
> --
> Lukas Gebauer.
>
> E-mail: gebau...@mlp.cz
> http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.
>
> ___
> 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] List of active savepoints names

2009-09-18 Thread Lukas Gebauer

Hello all!

I am searching some API function for get list of active savepoint 
names. Is this possible? Thank you!



-- 
Lukas Gebauer.

E-mail: gebau...@mlp.cz
http://synapse.ararat.cz/ - Ararat Synapse - TCP/IP Lib.

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