[Ajuda] Base MYSQL qual a diferenзa
#5

algo tipo isto funciona acho:

pawn Код:
#define SQL_WRITE 0
#define SQL_READ 1

#define SQL_TYPE SQL_WRITE

#define SQL_HOST "localhost"
#define SQL_DB "sampdb"

#define SQL_USER_WRITE "root"
#define SQL_USER_READ "root"

#define SQL_USER_WRITE_PASS ""
#define SQL_USER_READ_PASS ""

new g_Write, g_Read;

forward SQL_DB_CONNECT();
public SQL_DB_CONNECT()
{
    #if defined SQL_TYPE == SQL_WRITE
        g_Write = mysql_connect(SQL_HOST, SQL_USER_WRITE, SQL_DB, SQL_USER_WRITE_PASS);
        if(mysql_errno() != 0)
        {
            printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_WRITE);
            SendRconCommand("exit");
        }
        else
        {
            printf("  SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_WRITE);
        }
    #else
        g_Read = mysql_connect(SQL_HOST, SQL_USER_READ, SQL_DB, SQL_USER_READ_PASS);
        if(mysql_errno() != 0)
        {
            printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_READ);
            SendRconCommand("exit");
        }
        else
        {
            printf("  SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_READ);
            print(" ");
        }
    #endif
    return 1;
}
ja agora qual a diferenзa das 2 DB ?

e que se quer usar 2 base de dados esta fazendo certo agora se quiser salvar e ler na mesma nao esta fazendo certo.
Reply


Messages In This Thread
Base MYSQL qual a diferenзa - by maikons - 07.01.2015, 22:09
Re: Base MYSQL qual a diferenзa - by WLSF - 07.01.2015, 22:25
Re: Base MYSQL qual a diferenзa - by PT - 07.01.2015, 22:35
Re: Base MYSQL qual a diferenзa - by maikons - 07.01.2015, 22:38
Re: Base MYSQL qual a diferenзa - by PT - 07.01.2015, 22:46
Re: Base MYSQL qual a diferenзa - by maikons - 07.01.2015, 22:51
Re: Base MYSQL qual a diferenзa - by PT - 07.01.2015, 22:59
Re: Base MYSQL qual a diferenзa - by maikons - 07.01.2015, 23:49

Forum Jump:


Users browsing this thread: 1 Guest(s)