diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/printf.c | 2 | ||||
-rw-r--r-- | src/sqlite.h.in | 24 | ||||
-rw-r--r-- | src/sqliteInt.h | 27 | ||||
-rw-r--r-- | src/vdbeInt.h | 2 | ||||
-rw-r--r-- | src/vdbeapi.c | 8 |
6 files changed, 37 insertions, 30 deletions
diff --git a/src/main.c b/src/main.c index 04d0d75d9..20f7983d6 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.232 2004/06/21 08:18:52 danielk1977 Exp $ +** $Id: main.c,v 1.233 2004/06/22 12:13:55 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -436,7 +436,7 @@ static int nocaseCollatingFunc( /* ** Return the ROWID of the most recent insert */ -long long int sqlite3_last_insert_rowid(sqlite *db){ +sqlite_int64 sqlite3_last_insert_rowid(sqlite *db){ return db->lastRowid; } diff --git a/src/printf.c b/src/printf.c index 6d1059655..cb03b3dc1 100644 --- a/src/printf.c +++ b/src/printf.c @@ -345,7 +345,7 @@ static int vxprintf( */ switch( xtype ){ case etRADIX: - if( flag_longlong ) longvalue = va_arg(ap,INT64_TYPE); + if( flag_longlong ) longvalue = va_arg(ap,sqlite_int64); else if( flag_long ) longvalue = va_arg(ap,long int); else longvalue = va_arg(ap,int); #if 1 diff --git a/src/sqlite.h.in b/src/sqlite.h.in index aba3017b6..e532aea86 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -12,7 +12,7 @@ ** This header file defines the interface that the SQLite library ** presents to client programs. ** -** @(#) $Id: sqlite.h.in,v 1.105 2004/06/21 06:50:28 danielk1977 Exp $ +** @(#) $Id: sqlite.h.in,v 1.106 2004/06/22 12:13:55 drh Exp $ */ #ifndef _SQLITE_H_ #define _SQLITE_H_ @@ -45,6 +45,18 @@ typedef struct sqlite sqlite3; /* +** Some compilers do not support the "long long" datatype. So we have +** to do a typedef that for 64-bit integers that depends on what compiler +** is being used. +*/ +#if defined(_MSC_VER) || defined(__BORLANDC__) + typedef __int64 sqlite_int64; +#else + typedef long long int sqlite_int64; +#endif + + +/* ** A function to close the database. ** ** Call this function with a pointer to a structure that was previously @@ -152,7 +164,7 @@ int sqlite3_exec( ** ** This function is similar to the mysql_insert_id() function from MySQL. */ -long long int sqlite3_last_insert_rowid(sqlite3*); +sqlite_int64 sqlite3_last_insert_rowid(sqlite3*); /* ** This function returns the number of database rows that were changed @@ -623,7 +635,7 @@ typedef struct Mem sqlite3_value; int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); int sqlite3_bind_double(sqlite3_stmt*, int, double); int sqlite3_bind_int(sqlite3_stmt*, int, int); -int sqlite3_bind_int64(sqlite3_stmt*, int, long long int); +int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite_int64); int sqlite3_bind_null(sqlite3_stmt*, int); int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); @@ -802,7 +814,7 @@ int sqlite3_column_bytes(sqlite3_stmt*, int iCol); int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); double sqlite3_column_double(sqlite3_stmt*, int iCol); int sqlite3_column_int(sqlite3_stmt*, int iCol); -long long int sqlite3_column_int64(sqlite3_stmt*, int iCol); +sqlite_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); int sqlite3_column_type(sqlite3_stmt*, int iCol); @@ -908,7 +920,7 @@ int sqlite3_value_bytes(sqlite3_value*); int sqlite3_value_bytes16(sqlite3_value*); double sqlite3_value_double(sqlite3_value*); int sqlite3_value_int(sqlite3_value*); -long long int sqlite3_value_int64(sqlite3_value*); +sqlite_int64 sqlite3_value_int64(sqlite3_value*); const unsigned char *sqlite3_value_text(sqlite3_value*); const void *sqlite3_value_text16(sqlite3_value*); const void *sqlite3_value_text16le(sqlite3_value*); @@ -986,7 +998,7 @@ void sqlite3_result_double(sqlite3_context*, double); void sqlite3_result_error(sqlite3_context*, const char*, int); void sqlite3_result_error16(sqlite3_context*, const void*, int); void sqlite3_result_int(sqlite3_context*, int); -void sqlite3_result_int64(sqlite3_context*, long long int); +void sqlite3_result_int64(sqlite3_context*, sqlite_int64); void sqlite3_result_null(sqlite3_context*); void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a2a818f83..e6ad4a517 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.298 2004/06/22 11:29:02 danielk1977 Exp $ +** @(#) $Id: sqliteInt.h,v 1.299 2004/06/22 12:13:55 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -99,11 +99,12 @@ ** ** cc '-DUINTPTR_TYPE=long long int' ... */ -#ifndef INT64_TYPE -# define INT64_TYPE long long int -#endif #ifndef UINT64_TYPE -# define UINT64_TYPE unsigned long long int +# if defined(_MSC_VER) || defined(__BORLANDC__) +# define UINT64_TYPE unsigned __int64 +# else +# define UINT64_TYPE unsigned long long int +# endif #endif #ifndef UINT32_TYPE # define UINT32_TYPE unsigned int @@ -117,14 +118,17 @@ #ifndef INT8_TYPE # define INT8_TYPE signed char #endif +#ifndef LONGDOUBLE_TYPE +# define LONGDOUBLE_TYPE long double +#endif #ifndef INTPTR_TYPE # if SQLITE_PTR_SZ==4 # define INTPTR_TYPE int # else -# define INTPTR_TYPE long long +# define INTPTR_TYPE sqlite_int64 # endif #endif -typedef INT64_TYPE i64; /* 8-byte signed integer */ +typedef sqlite_int64 i64; /* 8-byte signed integer */ typedef UINT64_TYPE u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ @@ -150,15 +154,6 @@ typedef struct sqlite sqlite; #include "btree.h" /* -** Most C compilers these days recognize "long double", don't they? -** Just in case we encounter one that does not, we will create a macro -** for long double so that it can be easily changed to just "double". -*/ -#ifndef LONGDOUBLE_TYPE -# define LONGDOUBLE_TYPE long double -#endif - -/* ** This macro casts a pointer to an integer. Useful for doing ** pointer arithmetic. */ diff --git a/src/vdbeInt.h b/src/vdbeInt.h index f5b3673b6..688380dd0 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -385,7 +385,7 @@ int sqlite3VdbeMemCopy(Mem*, const Mem*); int sqlite3VdbeMemMove(Mem*, Mem*); int sqlite3VdbeMemNulTerminate(Mem*); int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); -void sqlite3VdbeMemSetInt64(Mem*, long long int); +void sqlite3VdbeMemSetInt64(Mem*, i64); void sqlite3VdbeMemSetDouble(Mem*, double); void sqlite3VdbeMemSetNull(Mem*); int sqlite3VdbeMemMakeWriteable(Mem*); diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 7be483463..ca488315c 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -52,7 +52,7 @@ int sqlite3_value_int(sqlite3_value *pVal){ sqlite3VdbeMemIntegerify(pMem); return (int)pVal->i; } -long long int sqlite3_value_int64(sqlite3_value *pVal){ +sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ Mem *pMem = (Mem *)pVal; sqlite3VdbeMemIntegerify(pMem); return pVal->i; @@ -324,7 +324,7 @@ double sqlite3_column_double(sqlite3_stmt *pStmt, int i){ int sqlite3_column_int(sqlite3_stmt *pStmt, int i){ return sqlite3_value_int( columnMem(pStmt,i) ); } -long long int sqlite3_column_int64(sqlite3_stmt *pStmt, int i){ +sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){ return sqlite3_value_int64( columnMem(pStmt,i) ); } const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){ @@ -468,9 +468,9 @@ int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){ return SQLITE_OK; } int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){ - return sqlite3_bind_int64(p, i, (long long int)iValue); + return sqlite3_bind_int64(p, i, (i64)iValue); } -int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, long long int iValue){ +int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){ int rc; Vdbe *p = (Vdbe *)pStmt; rc = vdbeUnbind(p, i); |