File is not a SQLite 3 Database
#1

Hello guys,

I'm having a problem with my SQLite database.... all the sudden when i try to open it with my SQLite database browser i get this error "File is not a SQLite 3 Database". This just happened after i added factions and faction ranks to my database... i had a error aswell saying that this line was to long after a submission (the line from the database under OnPlayerDisconnect)
pawn Код:
//the format line was the error line
new Query[128];
format(Query, sizeof(Query), "UPDATE users SET admin = %d, vip = %d, faction = %d, faction rank = %d, money = %d, rank = %d, exp = %d, kills = %d, deaths = %d WHERE username = '%s'", User[playerid][USER_ADMIN], User[playerid][USER_VIP], User[playerid][USER_FACTION], User[playerid][USER_FACTIONRANK], GetPlayerMoney(playerid), GetPlayerScore(playerid), User[playerid][USER_EXP], User[playerid][USER_KILLS], User[playerid][USER_DEATHS], DB_Escape(User[playerid][USER_NAME]));
db_query(Database, Query);
Help please?
Reply
#2

Is the size of the .db file 0?

I used to get that error when it created the .db file from the script and then tried to open it with a SQLite Browser before creating atleast a table (from the script).

EDIT: If the problem remains, then try to downgrade the version of the SQLite Browser.
Reply
#3

Wrong Post. Edited
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Is the size of the .db file 0?

I used to get that error when it created the .db file from the script and then tried to open it with a SQLite Browser before creating atleast a table (from the script).

EDIT: If the problem remains, then try to downgrade the version of the SQLite Browser.
Yes the file size is 0, which SQLite browser do you use or suggest?
Reply
#5

Quote:
Originally Posted by Voxel
Посмотреть сообщение
Yes the file size is 0, which SQLite browser do you use or suggest?
I used SQLite Database Browser 2.0 b1 and I recommend you to use it as well.

You can get rid of it easily, I've got two solutions.

1st: After opening the database to the script, execute a query to create a table (through the script).

2nd: Creating a new database and a table through the SQLite Browser.

For both of them, you will be able to open the .db file later on.
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
I used SQLite Database Browser 2.0 b1 and I recommend you to use it as well.

You can get rid of it easily, I've got two solutions.

1st: After opening the database to the script, execute a query to create a table (through the script).

2nd: Creating a new database and a table through the SQLite Browser.

For both of them, you will be able to open the .db file later on.
Yeah thats what i use aswell, how do i execute a query to create a table in the script?
Reply
#7

Quote:
Originally Posted by Voxel
Посмотреть сообщение
Yeah thats what i use aswell, how do i execute a query to create a table in the script?
An example:
pawn Код:
// In OnGameModeInit or OnFilterScriptInit:
Database = db_open( "server.db" );
db_query( Database, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129), admin INTEGER DEFAULT 0 NOT NULL)" );
Reply
#8

I found the real problem though, i had:
pawn Код:
db_query(Database, "CREATE TABLE IF NOT EXISTS users (userid INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(24) COLLATE NOCASE, password VARCHAR(129), admin INTEGER DEFAULT 0 NOT NULL, vip INTEGER DEFAULT 0 NOT NULL, faction VARCHAR(24) COLLATE NOCASE, factionrank INTEGER DEFAULT 0 NOT NULL, money INTEGER DEFAULT 0 NOT NULL, rank INTEGER DEFAULT 0 NOT NULL, exp INTEGER DEFAULT 0 NOT NULL, kills INTEGER DEFAULT 0 NOT NULL, deaths INTEGER DEFAULT 0 NOT NULL)");
factionrank was faction rank with a space in between, so i deleted the space and problem solved!

thanks again Konstantinos, dont know what i would have done without you !
Reply
#9

If your doing anything with SQLite make sure you use this include

https://sampforum.blast.hk/showthread.php?tid=303682

Add this to your gamemode

pawn Код:
#define DB_QUERY_ERRORS true
// automatically print errors (it's true by default)
#define DB_PRINT_ERRORS true
#include <sqlitei>
You will also need this

https://github.com/Zeex/amx_assembly

Now if there is any errors they will be printed out.
Reply
#10

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
If your doing anything with SQLite make sure you use this include

https://sampforum.blast.hk/showthread.php?tid=303682

Add this to your gamemode

pawn Код:
#define DB_QUERY_ERRORS true
// automatically print errors (it's true by default)
#define DB_PRINT_ERRORS true
#include <sqlitei>
You will also need this

https://github.com/Zeex/amx_assembly

Now if there is any errors they will be printed out.
Yes thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)