SQLite ( HELP ) - 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)
+--- Thread: SQLite ( HELP ) (
/showthread.php?tid=279721)
SQLite ( HELP ) -
Linus- - 28.08.2011
Hey,
I have a problem i have created an SQLite system for stats saving when i try to open my database via Readsql it gives an error ( An error occurred: File is not a SQLite 3 Database )
Screen:
And its not saving players data
Here's my OnFilterScriptInit:
pawn Код:
public OnFilterScriptInit()
{
Database = db_open("ServerDatabase.db");
new String[750];
strcat(String, "CREATE TABLE IF NOT EXISTS `USERS` ", 750);
strcat(String, "(\
`NAME`,\
`PASSWORD`,\
`IP`,\
`SCORE`,\
`CASH`,\
`ADMINLEVEL`,\
`KILLS`,\
`DEATHS`,\
`VIPLEVEL`,\
`Hours`,\
`Minutes`,\
`Seconds`,\
`RegisteredDate`\
)", 750);
// strcat(String, "", 750);
db_free_result(db_query(Database, DB_Escape(String)));
return 1;
}
Please help me thanks.
Re: SQLite ( HELP ) -
Stylock - 28.08.2011
I'm not sure but I think you need to set type for each column:
Код:
`NAME` VARCHAR(24),\
`PASSWORD` VARCHAR(256),\
`IP` VARCHAR(16),\
`SCORE` INT,\
Re: SQLite ( HELP ) -
FireCat - 28.08.2011
Quote:
Originally Posted by YJIET
I'm not sure but I think you need to set type for each column:
Код:
`NAME` VARCHAR(24),\
`PASSWORD` VARCHAR(256),\
`IP` VARCHAR(16),\
`SCORE` INT,\
|
That's not needed.
Re: SQLite ( HELP ) -
PrawkC - 28.08.2011
Use Navicat SQLlite.
Re: SQLite ( HELP ) -
Linus- - 29.08.2011
I was having no problems but when i add strcat strings in OnFilterScriptInIt then it wont works.
Re: SQLite ( HELP ) -
Bakr - 29.08.2011
Like you had said, you had no problems before using strcat, so why use it?
- Why do you use strcat when you know the two strings and they are less than the line limit?
- Why do you escape the string when you know what the input is?
- Why do you free the result when you don't select anything from the table?
- You should check to make sure database connection was actually established
- It's highly recommended to add the field types and maximum lengths