Raised This Month: $51 Target: $400
 12% 

Databases with AMXx 0.2


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Sonic
Junior Member
Join Date: Feb 2004
Location: Germany
Old 04-06-2004 , 16:50  
#21

bug in the connect function

Code:
static cell AMX_NATIVE_CALL sql_connect(AMX *amx, cell *params) //  6 param
{
  int i;
  const char *host = GET_AMXSTRING(amx,params[1],0,i);
  const char *user = GET_AMXSTRING(amx,params[2],1,i);
  const char *pass = GET_AMXSTRING(amx,params[3],2,i);
  const char *dbname = GET_AMXSTRING(amx,params[4],3,i);  
  
  sql_list* c = sql_exists(list_head,host,user,pass,dbname);
  
  if (c){
    add_owner(&c->owner,amx);
    return (cell)c->address;
  }
    
  c = create_sql(&list_head,host,user,pass,dbname);
  
  if (!c || !c->address)
    return MEM_ALLOC_FAILED;
  
  mysql_t *mysql = c->address;
    
  char *sqlerror=NULL;
  
  if(!sqlconnect(&(mysql->mysql),host,user,pass,dbname,&sqlerror)) {
    SET_AMXSTRING(amx,params[5],sqlerror ? sqlerror : "unknown error",params[6]);
    return CONNECT_FAILED;
  }
  
  SET_AMXSTRING(amx,params[5],"",params[6]);
  mysql->result = NULL;
  add_owner(&c->owner,amx);  
  
  return (cell)mysql;
}
on CONNECT_FAILED/MEM_ALLOC_FAILED we need to delete_sql from the sql list
or the next plugin that uses the connect function get no CONNECT_FAILED/MEM_ALLOC_FAILED error.

and please add support for last_insertid
__________________
Sonic is offline
BAILOPAN
Join Date: Jan 2004
Old 04-06-2004 , 18:40  
#22

thanks for the bug report I will fix that
__________________
egg
BAILOPAN is offline
Closed Thread



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 14:28.


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