Re: [sqlite] Determine if an index has been created
On 1 Feb 2013, at 10:12am, Paul Sandersonwrote: > I will know the name of the index - I just need to check that it has been > created. Oh, in that case just submit the 'CREATE' command. If the index already exists you'll get an error result and nothing will be done. If the index doesn't exist, it'll be created. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if an index has been created
Thank You On 1 February 2013 10:38, Roger Binnswrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 01/02/13 02:12, Paul Sanderson wrote: > > I will know the name of the index - I just need to check that it has > > been created. > > Just use pragma index_info on the index name. If it doesn't exist then > you get no rows returned and if it does exist then you a row per column in > the index. > > Roger > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.11 (GNU/Linux) > > iEYEARECAAYFAlELmyUACgkQmOOfHg372QSkCwCgvIzw59DcPMytdRssRs37YPRB > IUMAoKmyDMkKhdubaMqdmp/H9WLrkYAW > =WCNM > -END PGP SIGNATURE- > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if an index has been created
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/02/13 02:12, Paul Sanderson wrote: > I will know the name of the index - I just need to check that it has > been created. Just use pragma index_info on the index name. If it doesn't exist then you get no rows returned and if it does exist then you a row per column in the index. Roger -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAlELmyUACgkQmOOfHg372QSkCwCgvIzw59DcPMytdRssRs37YPRB IUMAoKmyDMkKhdubaMqdmp/H9WLrkYAW =WCNM -END PGP SIGNATURE- ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if an index has been created
I will know the name of the index - I just need to check that it has been created. On 1 February 2013 00:09, Simon Slavinwrote: > > On 31 Jan 2013, at 10:57pm, Igor Tandetnik wrote: > > > On 1/31/2013 5:45 PM, Paul Sanderson wrote: > >> Is it possible to ascertain if an index on a particular column has > already > >> been created. > > > > PRAGMA index_list(YourTable), then for each index, PRAGMA > index_info(IndexName) > > But note that one index can be on any number of columns. In fact if you > have long SELECT statements you probably have long indexes too. So do you > want to know if you have an index on just that one column, or if you have > any indexes which include that column ? > > Simon. > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Paul www.sandersonforensics.com skype: r3scue193 twitter: @sandersonforens Tel +44 (0)1326 572786 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if an index has been created
On 31 Jan 2013, at 10:57pm, Igor Tandetnikwrote: > On 1/31/2013 5:45 PM, Paul Sanderson wrote: >> Is it possible to ascertain if an index on a particular column has already >> been created. > > PRAGMA index_list(YourTable), then for each index, PRAGMA > index_info(IndexName) But note that one index can be on any number of columns. In fact if you have long SELECT statements you probably have long indexes too. So do you want to know if you have an index on just that one column, or if you have any indexes which include that column ? Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if an index has been created
On 1/31/2013 5:45 PM, Paul Sanderson wrote: Is it possible to ascertain if an index on a particular column has already been created. PRAGMA index_list(YourTable), then for each index, PRAGMA index_info(IndexName) -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users