Re: edbi on 64 bit machines?
- Posted by mattlewis (admin) Apr 27, 2012
- 4096 views
Jerome said...
I was able to succesfully run the t_myslq.e in unittest after putting in my mysql information, but had several failures. All of these tests pass on my 32bit system.
...
Hope this helps!
Yes! It looks like some of the edbi mysql driver isn't portable. I think edbi_next() is probably causing most (if not all) of this. Try updating it (untested):
function peek_longu( object ptr ) ifdef LONG32 then return peek4u( ptr ) elsedef return peek8u( ptr ) end ifdef end function public function edbi_next(atom dbr, atom row) atom p_lengths, p_row = c_func(h_mysql_fetch_row, {dbr}) integer field_count object data = {}, tmp row = row -- not used if p_row = 0 then return 0 end if p_lengths = mysql_fetch_lengths(dbr) field_count = mysql_num_fields(dbr) integer row_offset = 0 integer len_offset = 0 for i = 0 to (field_count - 1) * sizeof( C_POINTER ) by sizeof( C_POINTER ) do data &= {peek({peek_pointer(p_row + row_offset), peek_longu(p_lengths + len_offset)})} row_offset += sizeof( C_POINTER ) len_offset += sizeof( C_LONG ) end for return data end function
I think that this code has inspired me to add the peek/poke long variants to euphoria (possibly just in the std library).
Matt