First attempt at sql engine

This commit is contained in:
brianb
2001-04-08 01:32:43 +00:00
parent 5ceaff28ce
commit 58cb55ef0a
10 changed files with 680 additions and 1 deletions

View File

@@ -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)) {

View File

@@ -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;
}

View File

@@ -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)) {