~ubuntu-branches/ubuntu/oneiric/pxlib/oneiric

« back to all changes in this revision

Viewing changes to include/paradox.h.in

  • Committer: Bazaar Package Importer
  • Author(s): Uwe Steinmann
  • Date: 2006-02-15 12:26:20 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060215122620-1m63r9qen7xd0n2m
Tags: 0.6.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
        int px_fdc;
95
95
};
96
96
 
 
97
struct px_val {
 
98
        char isnull;
 
99
        int type;
 
100
        union {
 
101
                long lval;
 
102
                double dval;
 
103
                struct {
 
104
                        char *val;
 
105
                        int len;
 
106
                } str;
 
107
        } value;
 
108
};
 
109
 
97
110
struct px_head {
98
111
        char *px_tablename;
99
112
        int px_recordsize;
104
117
        int px_numfields;
105
118
        int px_maxtablesize;
106
119
        int px_headersize;
107
 
        int px_fileblocks;
108
 
        int px_firstblock;           // block number of first block
109
 
        int px_lastblock;            // block number of last block
 
120
        unsigned int px_fileblocks;
 
121
        unsigned int px_firstblock;  // block number of first block
 
122
        unsigned int px_lastblock;   // block number of last block
110
123
        int px_indexfieldnumber;
111
124
        int px_indexroot;            // number of root index block (only px files)
112
125
        int px_numindexlevels;       // number of index levels (only px files)
130
143
typedef struct px_field pxfield_t;
131
144
typedef struct px_pindex pxpindex_t;
132
145
typedef struct px_stream pxstream_t;
 
146
typedef struct px_val pxval_t;
133
147
typedef struct mb_head mbhead_t;
134
148
 
135
149
struct px_stream {
155
169
//      FILE *px_fp;       /* File pointer of file */
156
170
        pxstream_t *px_stream; /* input stream to read file from */
157
171
        char *px_name;     /* Name of file */
158
 
        int px_close_fp;   /* set to true if file pointer must be closed */
 
172
        int px_close_fp;   /* set to true if file pointer must be closed, deprecated */
159
173
//      int px_filemode;   /* set to pxfFileRead|pxfFileWrite */
160
174
        pxhead_t *px_head; /* Pointer to header of file */
161
175
        void *px_data;     /* Pointer to data of file (used in prim. index for
215
229
        unsigned char *curblock;       /* Data of block in read cache */
216
230
};
217
231
 
 
232
struct px_blockcache {
 
233
        long start;
 
234
        size_t size;
 
235
        unsigned char *data;
 
236
};
 
237
typedef struct px_blockcache pxblockcache_t;
 
238
 
 
239
struct px_mbblockinfo {
 
240
        int number;
 
241
        char type;
 
242
        char numblobs;
 
243
        int numblocks;
 
244
        int allocspace;
 
245
};
 
246
typedef struct px_mbblockinfo pxmbblockinfo_t;
 
247
 
218
248
struct px_blob {
219
249
        char *mb_name;
220
250
        pxdoc_t *pxdoc;
230
260
        int (*seek)(pxblob_t *p, pxstream_t *stream, long offset, int whence);
231
261
        long (*tell)(pxblob_t *p, pxstream_t *stream);
232
262
        size_t (*write)(pxblob_t *p, pxstream_t *stream, size_t numbytes, void *buffer);
 
263
        /* Cache for the last read block */
 
264
        pxblockcache_t blockcache;
 
265
        /* Index of all blocks in the blob file */
 
266
        pxmbblockinfo_t *blocklist;
 
267
        int blocklistlen;
233
268
};
234
269
 
235
270
struct mb_head {
257
292
                                                * data block in the database file. */
258
293
};
259
294
 
 
295
#define MAKE_PXVAL(pxdoc, pxval) \
 
296
        (pxval) = (pxval_t *) (pxdoc)->malloc((pxdoc), sizeof(pxval_t), "Allocate memory for pxval_t"); \
 
297
        memset((void *) (pxval), 0, sizeof(pxval_t));
 
298
 
 
299
#define FREE_PXVAL(pxdoc, pxval) \
 
300
        (pxdoc)->free((pxdoc), (pxval));
 
301
 
260
302
PXLIB_API int PXLIB_CALL
261
303
PX_get_majorversion(void);
262
304
 
275
317
PXLIB_API int PXLIB_CALL
276
318
PX_is_bigendian(void);
277
319
 
 
320
PXLIB_API char * PXLIB_CALL
 
321
PX_get_builddate(void);
 
322
 
278
323
PXLIB_API void PXLIB_CALL
279
324
PX_boot(void);
280
325
 
333
378
PXLIB_API int PXLIB_CALL
334
379
PX_put_record(pxdoc_t *pxdoc, char *data);
335
380
 
 
381
PXLIB_API int PXLIB_CALL
 
382
PX_insert_record(pxdoc_t *pxdoc, pxval_t **dataptr);
 
383
 
 
384
PXLIB_API int PXLIB_CALL
 
385
PX_update_record(pxdoc_t *pxdoc, pxval_t **dataptr, int recno);
 
386
 
 
387
PXLIB_API int PXLIB_CALL
 
388
PX_delete_record(pxdoc_t *pxdoc, int recno);
 
389
 
 
390
PXLIB_API pxval_t ** PXLIB_CALL
 
391
PX_retrieve_record(pxdoc_t *pxdoc, int recno);
 
392
 
336
393
PXLIB_API void PXLIB_CALL
337
394
PX_close(pxdoc_t *pxdoc);
338
395
 
339
396
PXLIB_API void PXLIB_CALL
340
397
PX_delete(pxdoc_t *pxdoc);
341
398
 
 
399
PXLIB_API int PXLIB_CALL
 
400
PX_pack(pxdoc_t *pxdoc);
 
401
 
342
402
PXLIB_API pxfield_t* PXLIB_CALL
343
403
PX_get_fields(pxdoc_t *pxdoc);
344
404
 
474
534
PXLIB_API long int PXLIB_CALL
475
535
PX_GregorianToSdn(int year, int month, int day);
476
536
 
 
537
PXLIB_API pxval_t* PXLIB_CALL
 
538
PX_make_time(pxdoc_t *pxdoc, int hour, int minute, int second);
 
539
 
 
540
PXLIB_API pxval_t* PXLIB_CALL
 
541
PX_make_date(pxdoc_t *pxdoc, int year, int month, int day);
 
542
 
 
543
PXLIB_API pxval_t* PXLIB_CALL
 
544
PX_make_timestamp(pxdoc_t *pxdoc, int year, int month, int day, int hour, int minute, int second);
 
545
 
477
546
PXLIB_API char * PXLIB_CALL
478
547
PX_timestamp2string(pxdoc_t *pxdoc, double value, const char *format);
479
548
 
480
549
PXLIB_API char * PXLIB_CALL
 
550
PX_time2string(pxdoc_t *pxdoc, long value, const char *format);
 
551
 
 
552
PXLIB_API char * PXLIB_CALL
 
553
PX_date2string(pxdoc_t *pxdoc, long value, const char *format);
 
554
 
 
555
PXLIB_API char * PXLIB_CALL
481
556
PX_strdup(pxdoc_t *pxdoc, const char *str);
482
557
 
483
558
#endif