Raised This Month: $32 Target: $400
 8% 

Solved Work with sqlx and sqlite in the same plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-02-2021 , 10:43   Work with sqlx and sqlite in the same plugin
Reply With Quote #1

I'm having doubts on how to use the 2 affinities at the same time, it may be that I have misunderstood when reading the include.

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
#include <sqlx>
#pragma defclasslib sqlite sqlite

#define PLUGIN  "New Plug-In"
#define VERSION "1.0"
#define AUTHOR  "Author"

public plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)

        
SQL_SetAffinity("sqlite")

        new 
aff[15]
        
SQL_GetAffinity(affcharsmax(aff))
        
server_print("Driver = %s"aff// Printed Driver = sqlite

        
set_task(2.0"ChangeDriver")
}

public 
ChangeDriver()
{
        
SQL_SetAffinity("sqlx")

        new 
aff[15]
        
SQL_GetAffinity(affcharsmax(aff))
        
server_print("Driver = %s"aff// Printed Driver = sqlite

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 07-02-2021 at 13:38.
iceeedr is offline
Send a message via Skype™ to iceeedr
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-02-2021 , 11:24   Re: Work with sqlx and sqlite in the same plugin
Reply With Quote #2

Quote:
Originally Posted by Arkshine View Post
Just a matter to select the wanted driver. API is the same.

SQL_SetAffinity("sqlite") or SQL_SetAffinity("mysql")

Now about autoloading module, depending what you want to do.
If you want to load only sqlite module, you need to do:
Code:
#pragma defclasslib sqlx sqlite
#include <sqlx>
if you want to load both module mysql and sqlite, so to change driver anytime, then:
Code:
#include "sqlx"
#pragma defclasslib sqlite sqlite
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 07-02-2021 , 12:52   Re: Work with sqlx and sqlite in the same plugin
Reply With Quote #3

Quote:
Originally Posted by iceeedr View Post

Code:
public ChangeDriver() {
        SQL_SetAffinity("mysql") // sqlx is not a driver, it's a module
        new aff[15]         SQL_GetAffinity(aff, charsmax(aff))         server_print("Driver = %s", aff) // Printed Driver = sqlite }
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 07-02-2021 , 13:38   Re: Work with sqlx and sqlite in the same plugin
Reply With Quote #4

Oops, lack of attention from me, I spent so much time trying to figure out the problem that it went unnoticed, thanks.
__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/
iceeedr is offline
Send a message via Skype™ to iceeedr
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode