Ejemplo n.º 1
0
	void open(string *filename) {
		db.init(*filename);
		db << "PRAGMA synchronous = OFF;";
		db << "CREATE TABLE IF NOT EXISTS metadata (name text, value text, UNIQUE (name));";
		db << "CREATE TABLE IF NOT EXISTS tiles (zoom_level integer, tile_column integer, tile_row integer, tile_data blob, UNIQUE (zoom_level, tile_column, tile_row));";
		db << "BEGIN;"; // begin a transaction
	}
Ejemplo n.º 2
0
void isomorph::init_DB_level(database &D, INT level, INT verbose_level)
{
	INT f_v = (verbose_level >= 1);
	btree B1, B2;
	INT f_compress = TRUE;
	INT f_duplicatekeys = TRUE;
	INT i;

	if (f_v) {
		cout << "isomorph::init_DB_level level=" << level << endl;
		}
	sprintf(fname_db_level, "%sstarter_lvl_%ld.db", prefix, level);
	sprintf(fname_db_level_idx1, "%sstarter_lvl_%ld_a.idx", prefix, level);
	sprintf(fname_db_level_idx2, "%sstarter_lvl_%ld_b.idx", prefix, level);
	sprintf(fname_db_level_ge, "%sstarter_lvl_%ld_ge.bin", prefix, level);

	D.init(fname_db_level, VECTOR, f_compress);
	
	B1.init(fname_db_level_idx1, f_duplicatekeys, 0 /* btree_idx */);
	B1.add_key_INT4(0, 0); 
	D.btree_access().append(B1);

	B2.init(fname_db_level_idx2, f_duplicatekeys, 1 /* btree_idx */);
		// 2 up to 2+level-1 are the values of the starter (of size level)
	for (i = 0; i < level; i++) {
		B2.add_key_INT4(2 + i, 0);
		}
	D.btree_access().append(B2);
}