11 vector<string> split( const string &line, char c, int limit = -1 ) {
12 string::size_type start = 0, end = 0;
15 while( 0 != limit-- && end != line.size() ) {
19 end = line.find( c, start );
20 if( end == string::npos ) {
24 out.push_back( line.substr( start, end-start ) );
30 int callback( void *NotUsed, int argc, char **argv, char **azColName ) {
32 for( int i = 0; i < argc; ++i ) {
33 cout << azColName[i] << " = " << ( argv[i] ? argv[i] : "NULL" ) << endl;
39 void sql_experimenting() {
41 char *sqliteErrMsg = 0;
44 const char *dbname = "test.db";
45 rc = sqlite3_open( dbname, &db );
46 if( SQLITE_OK != rc ) {
47 cerr << "Cannot open database: " << dbname << ". Error message is..." << endl;
48 cerr << sqlite3_errmsg(db) << endl;
51 rc = sqlite3_exec( db, "select * from filedata;", callback, 0, &sqliteErrMsg );
52 if( SQLITE_OK != rc ) {
53 cerr << "Problem with database. Message is..." << endl;
54 cerr << sqliteErrMsg << endl;
61 // string file_string;
63 // file_string.clear();
64 // for( int c = cin.get(); 0 != c && ! cin.eof(); c = cin.get() ) {
65 // file_string.push_back( c );
67 // if( 0 != file_string.size() ) {
69 // // type perms user group size datemodified name (7 total)
70 // // f 0600 cnb cnb 424 20051015205340 ./.git/index
71 // vector<string> values = split( file_string, ' ', 7 );
73 // } while( ! cin.eof() );