11.08.2012, 18:16
(
Последний раз редактировалось Maxips2; 14.07.2014 в 07:45.
)
Introduction:
Well I had this idea for a while, just never thought of developing and releasing it.
This include is made to save and load from MySQL easily, and doesn't require much knowledge in SQL.
Notes:
There are some things that you should know before using it:
- This version is outdated for BlueG's MySQL Plugin versions above R6-2. See the plugin version here: http://forum.sa-mp.com/showthread.ph...56#post3087456
- This include only supports BlueG's MySQL Plugin which can be found here: https://sampforum.blast.hk/showthread.php?tid=56564
- This include only supports versions R5, R6, R6-2.
- This include does not support cached queries.
- When loading, make sure you fetch the record first, and free the result when you are done!
Version:
• QueryBuilder v1.0 - Initial release
Known Bugs:
- None yet, however if you find a bug you can PM me about it, or reply here with details about the bug.
Functions:
Function Explanations:
Credits:
- ******: isnull macro
- BlueG: MySQL Plugin
- DrAkE: MultiUpdate and MultiGet idea
Downloads:
- BlueG's MySQL Plugin: Can be found here: https://sampforum.blast.hk/showthread.php?tid=56564
- QueryBuilder v1.0: Can be found here: http://www.solidfiles.com/d/cbc345d77d/
Please do not make any mirrors or upload to pastebin!
Conclusion:
This include can be useful for people who use MySQL in their gamemode.
If you have a suggestion, you can post here or just send me a PM on fourms.
I will be making a tutorial on how to use this include properly, if there is a demand for it, let me know!
Well I had this idea for a while, just never thought of developing and releasing it.
This include is made to save and load from MySQL easily, and doesn't require much knowledge in SQL.
Notes:
There are some things that you should know before using it:
- This version is outdated for BlueG's MySQL Plugin versions above R6-2. See the plugin version here: http://forum.sa-mp.com/showthread.ph...56#post3087456
- This include only supports BlueG's MySQL Plugin which can be found here: https://sampforum.blast.hk/showthread.php?tid=56564
- This include only supports versions R5, R6, R6-2.
- This include does not support cached queries.
- When loading, make sure you fetch the record first, and free the result when you are done!
Version:
• QueryBuilder v1.0 - Initial release
Known Bugs:
- None yet, however if you find a bug you can PM me about it, or reply here with details about the bug.
Functions:
pawn Код:
QueryBuilder_UpdateTable(table[], where[], whereclause[], connectionHandle = 1);
QueryBuilder_UpdateString(field[], value[]);
QueryBuilder_UpdateFloat(field[], Float:value);
QueryBuilder_UpdateInt(field[], value);
QueryBuilder_UpdateFinish();
QueryBuilder_MultiUpdate(format[], {Float,_}:...);
QueryBuilder_UpdateStringSingle(table[], where[], whereclause[], field[], value[], connectionHandle = 1);
QueryBuilder_UpdateIntSingle(table[], where[], whereclause[], field[], value, connectionHandle = 1);
QueryBuilder_UpdateFloatSingle(table[], where[], whereclause[], field[], Float:value, connectionHandle = 1);
QueryBuilder_FetchRecord(table[], field[], record[], fetchstr[], limit = 0, connectionHandle = 1);
QueryBuilder_GetInt(field[]);
Float:QueryBuilder_GetFloat(field[]);
QueryBuilder_GetStr(field[]);
QueryBuilder_GetStrEx(field[], dest[], size = sizeof dest, bool:pack = false);
QueryBuilder_MultiGet(getformat[], {Float,_}:...);
QueryBuilder_GetRowCount(table[], connectionHandle = 1);
QueryBuilder_PrintQuery();
QueryBuilder_Insert(table[], insformat[], {Float,_}:...);
Код:
QueryBuilder_UpdateTable(table[], where[], whereclause[], connectionHandle = 1) description: start building a query table[] - the table to update where[] - where to update whereclause[] - what record to update connectionHandle = 1 - which connection to update (default: 1) QueryBuilder_UpdateString(field[], value[]) description: update a string field[] - which field to update value[] - new string value to set QueryBuilder_UpdateFloat(field[], Float:value) description: update a float field[] - which field to update Float:value - new float value to set QueryBuilder_UpdateInt(field[], value) description: update an integer field[] - which field to update value - new integer value to set QueryBuilder_UpdateFinish() description: finish updating and send the query QueryBuilder_MultiUpdate(format[], {Float,_}:...) description: update multiple fields at once format[] - format the field and values (like sscanf) {Float,_}:... - Fields & Their Values (field, value) QueryBuilder_UpdateStringSingle(table[], where[], whereclause[], field[], value[], connectionHandle = 1) description: update a single field table[] - which table to update where[] - where to update whereclause[] - what record to update field[] - what field to update value[] - new string to set connectionHandle = which connection to update (default: 1) QueryBuilder_UpdateIntSingle(table[], where[], whereclause[], field[], value, connectionHandle = 1) description: update a single field table[] - which table to update where[] - where to update whereclause[] - what record to update field[] - what field to update value[] - new integer to set connectionHandle = which connection to update (default: 1) QueryBuilder_UpdateFloatSingle(table[], where[], whereclause[], field[], Float:value, connectionHandle = 1) description: update a single field table[] - which table to update where[] - where to update whereclause[] - what record to update field[] - what field to update value[] - new float to set connectionHandle = which connection to update (default: 1) QueryBuilder_FetchRecord(table[], field[], record[], fetchstr[], limit = 0, connectionHandle = 1) description: fetch a record table[] - which table to fetch from field[] - which field to fetch from fetchstr[] - string to store the result limit = 0 - how many records to fetch connectionHandle = which connection to fetch (default: 1) QueryBuilder_GetInt(field[]) description: get an integer from a field field[] - which field to get the integer from Float:QueryBuilder_GetFloat(field[]) description: get a float from a field field[] - which field to get the float from QueryBuilder_GetStr(field[]) description: get a string from a field field[] - which field to get the string from QueryBuilder_GetStrEx(field[], dest[], size = sizeof dest, bool:pack = false) description: get a string from a field (extra parameters) filed[] - which field to get the string from dest[] - array to store the string size - self explanatory pack - pack the string or not QueryBuilder_MultiGet(getformat[], {Float,_}:...) description: load multiple values at once getformat[] - format the field and values (like sscanf) {Float,_}:... - Fields & Their Values (field, value) QueryBuilder_GetRowCount(table[], connectionHandle = 1) description: count how many rows are in a table table[] - table to check how many rows are there connectionHandle = which connection to count (default: 1) QueryBuilder_PrintQuery() description: print the current query (will print null if used outside of the query building QueryBuilder_Insert(table[], insformat[], {Float,_}:...) description: insert a new row into a table insformat[] - format the field and values {Float,_}:... - Fields & Their Values (field, value)
- ******: isnull macro
- BlueG: MySQL Plugin
- DrAkE: MultiUpdate and MultiGet idea
Downloads:
- BlueG's MySQL Plugin: Can be found here: https://sampforum.blast.hk/showthread.php?tid=56564
- QueryBuilder v1.0: Can be found here: http://www.solidfiles.com/d/cbc345d77d/
Please do not make any mirrors or upload to pastebin!
Conclusion:
This include can be useful for people who use MySQL in their gamemode.
If you have a suggestion, you can post here or just send me a PM on fourms.
I will be making a tutorial on how to use this include properly, if there is a demand for it, let me know!