Re: [sqlite] UNIQUE in PRAGMA Table_Info

2011-09-10 Thread Petite Abeille

On Sep 10, 2011, at 9:41 AM, Thomas Baumann wrote:

> can you please add a column to the result of PRAGMA Table_Info() that
> indicates this column is UNIQUE?
> 
> Just like the notnull column.
> 
> I don't want to parse the whole sql string for this property only.
> 
> Or have I missed something?

Unfortunately such unique constraint is not advertised directly by any 
pragma... a possible workaround is to query index_info instead to retrieve, 
well, unique indices... and assume that if there is an unique index, there must 
be an unique constraint... YMMV...

Usage example, following the information schema convention [1]:

http://dev.alt.textdrive.com/browser/IMDB/Info.ddl#L177
http://dev.alt.textdrive.com/browser/IMDB/Info.ddl#L270
http://dev.alt.textdrive.com/browser/IMDB/Info.ddl#L459
http://dev.alt.textdrive.com/browser/IMDB/Info.lua#L204 

[1] http://en.wikipedia.org/wiki/Information_schema

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


Re: [sqlite] UNIQUE in PRAGMA Table_Info

2011-09-10 Thread Igor Tandetnik
Thomas Baumann  wrote:
> can you please add a column to the result of PRAGMA Table_Info() that
> indicates this column is UNIQUE?

What should be reported for this table definition:

create table FancyUnique(a, b, c, d, unique(a, b), unique(c, d) );

-- 
Igor Tandetnik

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


[sqlite] UNIQUE in PRAGMA Table_Info

2011-09-10 Thread Thomas Baumann
Hello,

 

can you please add a column to the result of PRAGMA Table_Info() that
indicates this column is UNIQUE?

Just like the notnull column.

I don't want to parse the whole sql string for this property only.

 

Or have I missed something?

 

 

Greetings and thanks in advance.

 

Thomas B.

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