Menu

#4 fetched wrong column lengths

open
nobody
None
5
2012-09-14
2002-09-30
Thomas Phan
No

hi,

fyi, i found that mysql c-api's long equals to c#'s int

public static ulong [] FetchLengths(IntPtr result)
{
int n = NumFields(result);
IntPtr lengths = FetchLengthsInternal(result);
if (lengths == IntPtr.Zero)
return null;
//int size =
System.Runtime.InteropServices.Marshal.SizeOf(typeof
(ulong));
ulong [] results = new ulong[n];
unsafe
{
//ulong * ptr = (ulong)lengths;
int * ptr = (int
)lengths;
for (int i = 0; i < n; i ++)
{
//results[i] = ptr[i];
results[i] = (ulong) ptr[i];
}
}
return results;
}

thomas

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.