[Include] SQLite.inc - Convenient and quick to use
#1

SQLite.inc - Convenient and quick to use

Introduction:
Hello and welcome to the subject of the publication my new include SQLite.inc!
Use SQLite.inc include will help you use SQLite in a much more simple and convenient.
The following example configuration of an additional row to any table:
PHP код:
sql_SetInt(Database,"Table","Field",100); 
Very simple is not it? Further issue will get the include and togetherness with a guide on all the functions it contains.
This is my first publication forum forgive my English

Functions:
The include right now in version v1.0 and contains 11 Functions, here the list:
PHP код:
sql_SetString<DB:database,table[],field[],value[]> 
sql_SetInt<DB:database,table[],field[],value>
sql_SetFloat<DB:database,table[],field[],Float:value>
sql_GetInt<DB:database,table[],field[],get[]>
sql_GetIntEx<DB:database,table[],field[],get[],equal[]>
Float:sql_GetFloat(DB:database,table[],field[],get[])
Float:sql_GetFloatEx(DB:database,table[],field[],get[],equal[])
sql_Exists<DB:database,table[],field[],value[]>
sql_GetString<DB:database,table[],field[],get[]>
sql_GetStringEx<DB:database,table[],field[],get[],equal[]>
sql_Count<DB:database,table[]> 
Alright,
if you working with this include and you want edit some user/clan/teleport you need the field of them have been exists.
For example you have this account:

UserName | UserPass | Kills | Deaths | AdminLevel
Agresiv | 123456 | 10 | 0 | 15

You need to make sure it already exists in the table.
For example after register to server:
PHP код:
db_query(Database,"INSERT INTO `Users` (`user_name`,`user_pass`) VALUES('Agresiv','123456')"); 
After you have the field in the table you can work with the SQLite include.
You can edit them / get information form them and other options below.

sql_SetString:
* This function performs the act of writing a string in the table.
* Example:
PHP код:
sql_SetString(Database,"ServerInfo","server_founder","Agresiv"); 
sql_SetInt:
* This function performs the act of writing a intager value in the table.
* Example:
PHP код:
sql_SetInt(Database,"ServerInfo","server_maxping",100); 
sql_SetFloat:
* This function performs the act of writing a float value in the table.
* Example:
PHP код:
sql_SetFloat(Database,"ServerInfo","players_health",100.0); 
sql_GetInt:
* This function return integer value from field in table.
* Example:
PHP код:
new max_ping sql_GetInt(Database,"ServerInfo","server_maxping");
printf("- Max Ping: %d",max_ping); 
sql_GetString:
* This function return string value from field in table.
* Example:
PHP код:
new founder[MAX_PLAYER_NAME];
format(founder,sizeof(founder),sql_GetString(Database,"ServerInfo","server_founder"));
printf("- Founder: %s",founder); 
sql_GetFloat:
* This function return float value from field in table.
* Example:
PHP код:
new Float:player_health sql_GetFloat(Database,"ServerInfo","players_health");
SetPlayerHealth(playerid,player_health); 
sql_GetIntEx:
* This function get integer value if some string equal to field in table.
* Example:
PHP код:
new kills[MAX_PLAYERS],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
kills[playerid] = sql_GetIntEx(Database,"Users","user_name","user_kills",name); 
sql_GetStringEx:
* This function get string value if some string equal to field in table.
* Example:
PHP код:
new password[20],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(password,sizeof(password),sql_GetStringEx(Database,"Users","user_name","user_pass",name)); 
sql_GetFloatEx:
* This function get float value if some string equal to field in table.
* Example:
PHP код:
new Float:playerX[MAX_PLAYERS],name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
playerX[playerid] = sql_GetFloatEx(Database,"Users","user_name","user_x",name); 
sql_Exists:
* This function check if field exists in the table.
* Example:
PHP код:
new bool:state,name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
state sql_Exists(Database,"Users","user_name",name)?true:false;
print(
state?("User Exists!"):("User dosen't exists!")); 
sql_Count:
* This function count all fields in table.
* Example:
PHP код:
new countUsers sql_Count(Database,"Users");
printf("Users: %d",countUsers); 
Credits:
Agresiv (Dan Elimelech | Dumbes) - Developer include.
Amit_B (Amit Barami) - Scripting help & Inspiration.

Downloads:
To use SQLite.inc include you don't need plugins and additives, just include a_sampdb.inc
a_sampdb.inc include you get a download server.
Pastebin: http://pastebin.com/0euXZNwW

If you find bug send me email: deagresiv16@gmail.com
All function are check and with this include right now i build new big project!
Reply
#2

I appreciate that you are trying to contribute but why bother using this at all ? We have a far superior sqlite extension here.

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

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
I appreciate that you are trying to contribute but why bother using this at all ? We have a far superior sqlite extension here.

https://sampforum.blast.hk/showthread.php?tid=303682
It's completely different, it is best not to respond if you have not read the whole topic
Reply
#4

I read it dude, your not really offering anything here that would be useful I think or better than what we have already.
Reply
#5

I dont think so anything wrong in releasing a similar thing.
However i must say there should be some comparison so as to compete this version with SQLiteI..

I've been using SQLiteI since long and must say it is quite beneficial and so as this include seem good too.
Reply
#6

^why?? a better question..@op why

Код:
#define function:%0<%1> stock sql_%0(%1)
why??

@op - *i'm *guessing you're AmitB. just a hunch..bets anyone??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)