SA-MP Forums Archive
Check programmatically if table exists in SQLite - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Check programmatically if table exists in SQLite (/showthread.php?tid=201851)



Check programmatically if table exists in SQLite - RyDeR` - 22.12.2010

Hi, I know how to create a table if not exists but how can I pre-check programmatically if a table exists?

I'm using like this at the moment:
Код:
CREATE TABLE IF NOT EXISTS `TABLENAME` (`columns`)
which works perfect.


Re: Check programmatically if table exists in SQLite - RyDeR` - 22.12.2010

Solved.

If anyone wants to know:
pawn Код:
if(!db_query(DB: database, "SELECT * FROM `table` LIMIT 1"))
{
        // doesn't exist
}
else
{
        // it does exist
}