/home/martin/workspace/OpenStreetNav/src/sqlitetest/main.cc
Go to the documentation of this file.
00001 /*
00002  * main.cc
00003  *
00004  *  Created on: Nov 13, 2011
00005  *      Author: martin
00006  */
00007 
00008 #include <ctime>
00009 #include <istream>
00010 #include <iostream>
00011 #include <fstream>
00012 #include "../sqlite/sqlitewrap.h"
00013 
00014 int main(int argc, char** argv)
00015 {
00016     if (argc != 3)
00017     {
00018         std::cout << "sqlitetest db sql" << std::endl;
00019         return 1;
00020     }
00021     std::string sql;
00022     std::ifstream s(argv[2]);
00023     std::string str;
00024     while (!s.eof())
00025     {
00026         s >> str;
00027         sql += str + " ";
00028     }
00029     sqlite::Database db(argv[1]);
00030     clock_t t0 = clock();
00031     sqlite::Statement st(sql, db);
00032     clock_t t1 = clock();
00033     std::cout << "prepare: " << (t1 - t0) / (double)CLOCKS_PER_SEC << std::endl;
00034     t0 = clock();
00035     int i = 0;
00036     while (!st.done())
00037     {
00038         i++;
00039         st.step();
00040     }
00041     t1 = clock();
00042     std::cout << "execute: " << i << " " << (t1 - t0) / (double)CLOCKS_PER_SEC << std::endl;
00043     return 0;
00044 }
00045 
00046 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines