hackinghat / cl-mysql

Common Lisp MySQL library
http://hackinghat.com/index.php/cl-mysql
53 stars 17 forks source link

fix process-row so cl-mysql works in Windows x64 #18

Closed richardjdare closed 7 years ago

richardjdare commented 7 years ago

I might have a fix for issue https://github.com/hackinghat/cl-mysql/issues/11 If we take a look at process-row in mysql.lisp: https://github.com/hackinghat/cl-mysql/blob/76b570c1119de77f53f5f293f03ce32f312a89a9/mysql.lisp#L359-L368

int-size needs to be 8 on win64, but (foreign-type-size :long) is 4 on win64 (and 8 on x64 linux) So I replaced it with (foreign-type-size :pointer) which should be 8 on windows and linux x64, and 4 in 32 bit, which is what we want.

However, this now means that the value passed in i to (mem-ref mysql-lens ...) is incorrect. So I replaced mem-ref with mem-aref which accesses the memory in an array-like fashion (index = 0,1 etc instead of ptr lengths) and divided i by int-size to step it down.

This works with my test db in Windows 10 x64 and Arch Linux.

I'm only a beginner with Lisp, so let me know if I've overlooked something.