X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=interfaces%2Fmysql%2Fclsql-mysql.c;h=91bcd06ab65db3c891cdf7a089c8aa6241fb65be;hb=42a951e9f7152e7c145958f4dfed41d4e865c9fd;hp=4fd36dbaa989de099a0a38258c6bb5aef8ee3786;hpb=8e83690d8dc88baafeb75f5b48a80a6c0e6a89c3;p=clsql.git diff --git a/interfaces/mysql/clsql-mysql.c b/interfaces/mysql/clsql-mysql.c index 4fd36db..91bcd06 100644 --- a/interfaces/mysql/clsql-mysql.c +++ b/interfaces/mysql/clsql-mysql.c @@ -1,12 +1,12 @@ /**************************************************************************** * 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.2 2002/03/27 05:37:35 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 * @@ -53,10 +53,18 @@ clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32, 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) @@ -76,27 +84,3 @@ clsql_mysql_insert_id (MYSQL* mysql, 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; - - while (*str) { - int i = *str - '0'; - if (i < 0 || i > 9) /* Non-numeric character -- quit */ - break; - result = i + (10 * result); - str++; - } - - *pHigh32 = upper_32bits(result); - return lower_32bits(result); -} - - - -