/****************************************************************************
* FILE IDENTIFICATION
*
- * Name: mysql-helper.cl
+ * Name: clsql-mysql.c
* Purpose: Helper functions for mysql.cl to handle 64-bit parts of API
* Programmer: Kevin M. Rosenberg
* Date Started: Mar 2002
*
- * $Id: clsql-mysql.c,v 1.3 2002/03/27 05:48:22 kevin Exp $
+ * $Id: clsql-mysql.c,v 1.4 2002/03/27 08:09:25 kevin Exp $
*
* This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
*
located sent via a pointer */
const unsigned int bitmask_32bits = 0xFFFFFFFF;
-
#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+DLLEXPORT
+unsigned int
+clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
+{
+ my_ulonglong nRows = mysql_num_rows (res);
+ *pHigh32 = upper_32bits(nRows);
+ return lower_32bits(nRows);
+}
+
DLLEXPORT
unsigned int
clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
}
-/* Reads a 64-bit integer string, returns result as two 32-bit integers */
-
-DLLEXPORT
-unsigned int
-atol64 (const unsigned char* str, int* pHigh32)
-{
- long long result = 0;
- int minus = 0;
- int first_char = *str;
- if (first_char == '+')
- ++str;
- else if (first_char == '-') {
- minus = 1;
- ++str;
- }
-
- while (*str) {
- int i = *str - '0';
- if (i < 0 || i > 9) /* Non-numeric character -- quit */
- break;
- result = i + (10 * result);
- str++;
- }
- if (minus)
- result = -result;
-
- *pHigh32 = upper_32bits(result);
- return lower_32bits(result);
-}
-
-
-
-