#include "ruby.h" #include #include #include #define GetMysqlRes(obj) (Check_Type(obj, T_DATA), ((struct mysql_res*)DATA_PTR(obj))->res) #define GetLongPtr(obj) (Check_Type(obj, T_DATA), (long*)DATA_PTR(obj)) #define GetCharPtr(obj) (Check_Type(obj, T_DATA), (char*)DATA_PTR(obj)) #define GetCharStarPtr(obj) (Check_Type(obj, T_DATA), (char**)DATA_PTR(obj)) VALUE cRowHash, cClass; // from mysql/ruby struct mysql_res { MYSQL_RES* res; char freed; }; // row info #define SLIM_IS_NULL (char)1 #define SLIM_IS_SET (char)2 static VALUE all_hashes(VALUE obj) { MYSQL_RES *res = GetMysqlRes(obj); MYSQL_FIELD *fields = mysql_fetch_fields(res); MYSQL_ROW row; VALUE all_hashes_ary, col_names_hsh, row_ary; my_ulonglong nr = mysql_num_rows(res); unsigned int nf = mysql_num_fields(res); unsigned int i, j, s; unsigned long *lengths; char *row_space, *row_info_space, **pointers_space; /* hash of column names */ col_names_hsh = rb_hash_new(); for (i=0; i