1 /****************************************************************************
5 * Purpose: Helper functions for mysql.cl to handle 64-bit parts of API
6 * Programmer: Kevin M. Rosenberg
7 * Date Started: Mar 2002
9 * $Id: clsql-mysql.c,v 1.4 2002/03/27 08:09:25 kevin Exp $
11 * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 * CLSQL users are granted the rights to distribute and use this software
14 * as governed by the terms of the Lisp Lesser GNU Public License
15 * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
16 ***************************************************************************/
21 BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
27 #define DLLEXPORT __declspec(dllexport)
36 /* Need to assemble a 64-bit integer to send to MySQL */
39 clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
40 unsigned int offset_low32)
44 offset = offset_high32;
45 offset = offset << 32;
46 offset += offset_low32;
48 mysql_data_seek (res, offset);
51 /* The following functions are used to return 64-bit integers to Lisp.
52 They return the 32-bit low part and store in upper 32-bits in a
53 located sent via a pointer */
55 const unsigned int bitmask_32bits = 0xFFFFFFFF;
56 #define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
57 #define upper_32bits(int64) ((unsigned int) (int64 >> 32))
61 clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
63 my_ulonglong nRows = mysql_num_rows (res);
64 *pHigh32 = upper_32bits(nRows);
65 return lower_32bits(nRows);
70 clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
72 my_ulonglong nAffected = mysql_affected_rows (res);
73 *pHigh32 = upper_32bits(nAffected);
74 return lower_32bits(nAffected);
79 clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
81 my_ulonglong insert_id = mysql_insert_id (mysql);
82 *pHigh32 = upper_32bits(insert_id);
83 return lower_32bits(insert_id);