Re: [sqlite] Detailed error code

2012-04-14 Thread Richard Hipp
On Sat, Apr 14, 2012 at 7:30 AM,  wrote:

> When I try to create a table that already exists inside a database I
> obtain the error message: "table xyz already exists" and the error code is
> 1.
> Is there a way to obtain a more specific error code that can
> programmatically inform me that the object is already inside the db?
>

Not at this time.  This is something that needs to be improved upon in
SQLite:  we need to work on providing a unique extended error code for
every possible error.



> Seems like also Extended Result Codes do not cover this case.
>
> Please help.
> Thanks let me know.
> --
> Marco Bambini
> http://www.sqlabs.com
>
> ___
> 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


Re: [sqlite] Detailed error code

2012-04-14 Thread Simon Slavin

On 14 Apr 2012, at 12:30pm, ma...@sqlabs.net wrote:

> When I try to create a table that already exists inside a database I
> obtain the error message: "table xyz already exists" and the error code is
> 1.
> Is there a way to obtain a more specific error code that can
> programmatically inform me that the object is already inside the db?
> Seems like also Extended Result Codes do not cover this case.

Use any of the functions on this page:



The first one is the one that returned the '1' you saw.  I think the last two 
return the actual text message you saw, so you could parse that and recognise 
the actual error.

As an alternative for the specific commmand you asked about, you can use

CREATE TABLE IF NOT EXISTS ...

which is probably what you're trying to do anyway.

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


[sqlite] Detailed error code

2012-04-14 Thread marco
When I try to create a table that already exists inside a database I
obtain the error message: "table xyz already exists" and the error code is
1.
Is there a way to obtain a more specific error code that can
programmatically inform me that the object is already inside the db?
Seems like also Extended Result Codes do not cover this case.

Please help.
Thanks let me know.
--
Marco Bambini
http://www.sqlabs.com

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