1 /****************************************************************************
4 * Name: mysql-helper.cl
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.1 2002/03/23 14:04:52 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;
57 #define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
58 #define upper_32bits(int64) ((unsigned int) (int64 >> 32))
62 clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
64 my_ulonglong nRows = mysql_num_rows (res);
65 *pHigh32 = upper_32bits(nRows);
66 return lower_32bits(nRows);
71 clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
73 my_ulonglong nAffected = mysql_affected_rows (res);
74 *pHigh32 = upper_32bits(nAffected);
75 return lower_32bits(nAffected);
80 clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
82 my_ulonglong insert_id = mysql_insert_id (mysql);
83 *pHigh32 = upper_32bits(insert_id);
84 return lower_32bits(insert_id);