28.11.2014, 17:21
It's possible for other things using MySQL. But there's no function for it in "BlueG's MySQL Plugin".
mysql_fetch_row_format Description: Use this function to fetch whole row from the result set. Image:32px-Ambox_warning_orange.png Note This function also moves the internal row pointer to the next row. |
new data[4]; new row_data[128]; while(mysql_fetch_row_format(row_data)) { sscanf("p<|>...", data[0], data[1], ...); }
new data[4]; for(new r=0; r < cache_num_rows(); r++) { data[0] = cache_get_row_int(r, 0); //store the first field (index '0') into data[0] data[1] = cache_get... }
#include <a_samp>
#define MYSQL_USE_YINLINE
#include <a_mysql>
new dbhandle;
forward Qt();
public Qt() {
print("Public instead");
}
public OnGameModeInit() {
dbhandle = mysql_connect("localhost", "root", "samp_733", "");
inline Fetch() {
printf("Inline");
}
mysql_tquery_inline(dbhandle, "SELECT 2 + 2 AS foobar FROM dual", using inline Fetch, "");
mysql_tquery(dbhandle, "SELECT 2 + 2 AS foobar FROM dual", "Qt", "");
return 1;
}
main() {
print("Hello");
}
[11:26:03] Hello [11:26:03] Number of vehicle models: 0 [11:26:03] Inline [11:26:03] Inline [11:26:03] Public instead |
new tmp[32];
cache_get_field_content(0, "IntField",tmp);
place_where_i_want_to_put_it = (ismysqlnull(tmp)) ? (some int value) : (strval(tmp));
I understand that they are completely different. I'm just asking for a easier way to check if it's null. Something like "is_field_null(row, const fieldname[])" would be nice.
|
SELECT * FROM table_name WHERE field_name IS NULL
bool:cache_is_field_null(row_idx, const field_name[]) { new dest[5]; cache_get_field_content(row_idx, field_name, dest); return (strcmp(dest, "NULL") == 0); }