- file_string.clear();
- for( int c = cin.get(); 0 != c && ! cin.eof(); c = cin.get() ) {
- file_string.push_back( c );
- }
- if( 0 != file_string.size() ) {
- // Example entry
- // type perms user group size datemodified name (7 total)
- // f 0600 cnb cnb 424 20051015205340 ./.git/index
- vector<string> vals = split( file_string, ' ', 7 );
- current.insert( new FileData( vals[0][0],
- vals[1],
- vals[2],
- vals[3],
- atoi( vals[4].c_str() ),
- atoi( vals[5].c_str() ),
- vals[6]) );
- }
- } while( ! cin.eof() );
-
- // Get the list of previously backed up files from the database.
- sqlite3 *db;
-
- const char *dbname = "test.db";
- int rc = sqlite3_open( dbname, &db );
- assert( SQLITE_OK == rc );
-
- char *sqliteErrMsg = 0;
- file_set backed_up;
- rc = sqlite3_exec( db, "select * from filedata;", populate_set, &backed_up, &sqliteErrMsg );
- assert( SQLITE_OK == rc );
-
- rc = sqlite3_close( db );
- assert( SQLITE_OK == rc );