10.12.2012, 18:25
Today i learned how to check via SAMP Script that a SQLite Database exists with in the opened database.
This is how you can do it , custom function.
Usage of the function!
This is how you can do it , custom function.
pawn Code:
stock IsSQLiteDatabaseExists(dbname[])
{
format(query,sizeof(query),"SELECT * FROM `%s` LIMIT 1",dbname);
if(!db_query(DB: database, query)) return 0; else return 1;
}
pawn Code:
if(!IsSQLiteDatabaseExists("SAMP"))
{
printf("[SQLite] SAMP Table does not exists , Creating one... Created Successfully!");
}
//Note: You must have opened have declared the dbname as "database" or you change the dbname used in the above function which is opened by the script and operations are done on it.