DBD-SQLite2
view release on metacpan or search on metacpan
#include "sqliteInt.h"
#include "pager.h"
#include "btree.h"
#include <assert.h>
/* Forward declarations */
static BtOps sqliteBtreeOps;
static BtCursorOps sqliteBtreeCursorOps;
/*
** Macros used for byteswapping. B is a pointer to the Btree
** structure. This is needed to access the Btree.needSwab boolean
** in order to tell if byte swapping is needed or not.
** X is an unsigned integer. SWAB16 byte swaps a 16-bit integer.
** SWAB32 byteswaps a 32-bit integer.
*/
#define SWAB16(B,X) ((B)->needSwab? swab16((u16)X) : ((u16)X))
#define SWAB32(B,X) ((B)->needSwab? swab32(X) : (X))
#define SWAB_ADD(B,X,A) \
if((B)->needSwab){ X=swab32(swab32(X)+A); }else{ X += (A); }
/*
** Access routines. To delete, insert a NULL pointer.
*/
void sqliteHashInit(Hash*, int keytype, int copyKey);
void *sqliteHashInsert(Hash*, const void *pKey, int nKey, void *pData);
void *sqliteHashFind(const Hash*, const void *pKey, int nKey);
void sqliteHashClear(Hash*);
/*
** Macros for looping over all elements of a hash table. The idiom is
** like this:
**
** Hash h;
** HashElem *p;
** ...
** for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){
** SomeStructure *pData = sqliteHashData(p);
** // do something with pData
** }
*/
** The DJGPP compiler environment looks mostly like Unix, but it
** lacks the fcntl() system call. So redefine fcntl() to be something
** that always succeeds. This means that locking does not occur under
** DJGPP. But its DOS - what did you expect?
*/
#ifdef __DJGPP__
# define fcntl(A,B,C) 0
#endif
/*
** Macros used to determine whether or not to use threads. The
** SQLITE_UNIX_THREADS macro is defined if we are synchronizing for
** Posix threads and SQLITE_W32_THREADS is defined if we are
** synchronizing using Win32 threads.
*/
#if OS_UNIX && defined(THREADSAFE) && THREADSAFE
# include <pthread.h>
# define SQLITE_UNIX_THREADS 1
#endif
#if OS_WIN && defined(THREADSAFE) && THREADSAFE
# define SQLITE_W32_THREADS 1
#endif
#if OS_MAC && defined(THREADSAFE) && THREADSAFE
# include <Multiprocessing.h>
# define SQLITE_MACOS_MULTITASKING 1
#endif
/*
** Macros for performance tracing. Normally turned off
*/
#if 0
static int last_page = 0;
__inline__ unsigned long long int hwtime(void){
unsigned long long int x;
__asm__("rdtsc\n\t"
"mov %%edx, %%ecx\n\t"
:"=A" (x));
return x;
}
**
** @(#) $Id: pager.c,v 1.1.1.1 2004/08/08 15:03:57 matt Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
#include "pager.h"
#include <assert.h>
#include <string.h>
/*
** Macros for troubleshooting. Normally turned off
*/
#if 0
static Pager *mainPager = 0;
#define SET_PAGER(X) if( mainPager==0 ) mainPager = (X)
#define CLR_PAGER(X) if( mainPager==(X) ) mainPager = 0
#define TRACE1(X) if( pPager==mainPager ) fprintf(stderr,X)
#define TRACE2(X,Y) if( pPager==mainPager ) fprintf(stderr,X,Y)
#define TRACE3(X,Y,Z) if( pPager==mainPager ) fprintf(stderr,X,Y,Z)
#else
#define SET_PAGER(X)
( run in 0.659 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )