mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-09-19 02:27:55 +08:00
First attempt at sql engine
This commit is contained in:
@@ -106,6 +106,7 @@ int next_pg, next_pg_off;
|
||||
#if 0
|
||||
next_pg = MDB_CATALOG_PG;
|
||||
mdb_free_catalog(mdb);
|
||||
mdb->num_catalog = 0;
|
||||
|
||||
while (next_pg) {
|
||||
mdb_read_pg(mdb, next_pg);
|
||||
@@ -126,6 +127,9 @@ int next_pg, next_pg_off;
|
||||
}
|
||||
return (mdb->catalog);
|
||||
#endif
|
||||
mdb_free_catalog(mdb);
|
||||
mdb->num_catalog = 0;
|
||||
|
||||
mdb->catalog = g_array_new(FALSE,FALSE,sizeof(MdbCatalogEntry));
|
||||
next_pg=0;
|
||||
while (mdb_read_pg(mdb,next_pg)) {
|
||||
|
@@ -411,3 +411,39 @@ time_t t;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
int mdb_col_disp_size(MdbColumn *col)
|
||||
{
|
||||
switch (col->col_type) {
|
||||
case MDB_BOOL:
|
||||
return 1;
|
||||
break;
|
||||
case MDB_BYTE:
|
||||
return 3;
|
||||
break;
|
||||
case MDB_INT:
|
||||
return 5;
|
||||
break;
|
||||
case MDB_LONGINT:
|
||||
return 7;
|
||||
break;
|
||||
case MDB_FLOAT:
|
||||
return 10;
|
||||
break;
|
||||
case MDB_DOUBLE:
|
||||
return 10;
|
||||
break;
|
||||
case MDB_TEXT:
|
||||
return col->col_size;
|
||||
break;
|
||||
case MDB_SDATETIME:
|
||||
return 20;
|
||||
break;
|
||||
case MDB_MEMO:
|
||||
return 255;
|
||||
break;
|
||||
case MDB_MONEY:
|
||||
return 12;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ int j,pos;
|
||||
mdb->fd = open(filename,O_RDONLY);
|
||||
|
||||
if (mdb->fd==-1) {
|
||||
fprintf(stderr,"Couldn't open file %s\n",filename);
|
||||
/* fprintf(stderr,"Couldn't open file %s\n",filename); */
|
||||
return NULL;
|
||||
}
|
||||
if (!mdb_read_pg(mdb, 0)) {
|
||||
|
Reference in New Issue
Block a user