db_get_field_int Questions.
#1

Hi, I've a question... I would like to know if there's another way to replace db_get_field_int and db_get_field_assoc_int in SA-MP versions lower than 0.3.7.

I made those codes and they work correctly, but as I said... їthere's another way to replace them?

Code:
SQLfield_int(DBResult:dbresult, col = 0)
{
	static columna[10];
	db_get_field(dbresult, col, columna, sizeof(columna));
	new const valor_int = strval(columna);
	return valor_int;
}

SQLfield_assoc_int(DBResult:dbresult, const col[])
{
	static columna[10];
	db_get_field_assoc(dbresult, col, columna, sizeof(columna));
	new const valor_int = strval(columna);
	return valor_int;
}
If there's not another way, at least I want to know if those codes are optimized.

Thank you for your time
Reply
#2

PHP Code:
db_get_field_assoc_int(DBResultresultfield 0)
{
    new 
_field[20], _field_int;
    
db_get_field(resultfield_fieldsizeof _field);
    
_field_int strval(_field);
    return 
_field_int;

Don't use this together.
PHP Code:
new const 
Use
PHP Code:
new 
.
Reply
#3

їAnd what about the static variable?, I Thought I could use it since I'm using it only in this code and the integer is now in a new variable.
Reply
#4

You can use static variables though.
Reply
#5

Ok, thank you guys for answer my questions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)