bool IndDBase::attach( const std::string & n ) { if ( n == "-" || n == "." ) { dettach(); return false; } if ( ! Helper::fileExists(n) ) { new_db(n); return true; } sql.open(n); index(); init(); // // Load new meta-information table // set_metatypes( ); return true; }
bool NetDBase::attach( const std::string & name ) { if ( name == "-" || name == "." ) { dettach(); return false; } //if ( Helper::fileExists( name ) ) { sql.open( name ); return true; } if ( attached() ) dettach(); sql.open( name ); // Create database sql.synchronous(false); // Edge table ( double-enter n1-n2 and n2-n1 ) sql.query(" CREATE TABLE IF NOT EXISTS edges(" " node1_id INTEGER , " " node2_id INTEGER , " " score REAL ) ; " ); sql.query( "CREATE TABLE IF NOT EXISTS nodes(" " node_id INTEGER PRIMARY KEY , " " name VARCHAR(12) ); " ); // Indices index(); stmt_insert_node = sql.prepare( " INSERT OR REPLACE INTO nodes( name ) values( :name ); " ); stmt_fetch_node = sql.prepare( " SELECT node_id FROM nodes WHERE name == :name ; " ); stmt_insert_edge = sql.prepare( " INSERT OR REPLACE INTO edges( node1_id , node2_id , score ) values( :n1 , :n2 , :score ); " ); stmt_fetch_connections = sql.prepare( " SELECT name FROM nodes WHERE node_id IN ( SELECT node2_id FROM edges WHERE node1_id == :n ) ; " ); return true; }
void CSoundRender_Target::stop () { dettach (); pEmitter = NULL; rendering = FALSE; }
OSGLContextAttacher::~OSGLContextAttacher() { dettach(); }
~SharedMemory() { dettach(); }
void CSoundRender_TargetA::source_changed() { dettach(); attach(); }