· 8 years ago · Feb 28, 2018, 10:36 AM
1/*************************************************************
2 Baseline code to experiment with SQLite performance.
3
4 Input data is a 28 MB TAB-delimited text file of the
5 complete Toronto Transit System schedule/route info
6 from http://www.toronto.ca/open/datasets/ttc-routes/
7
8**************************************************************/
9#include <stdio.h>
10#include <stdlib.h>
11#include <time.h>
12#include <string.h>
13#include "sqlite3.h"
14
15#define INPUTDATA "C:\TTC_schedule_scheduleitem_10-27-2009.txt"
16#define DATABASE "c:\TTC_schedule_scheduleitem_10-27-2009.sqlite"
17#define TABLE "CREATE TABLE IF NOT EXISTS TTC (id INTEGER PRIMARY KEY, Route_ID TEXT, Branch_Code TEXT, Version INTEGER, Stop INTEGER, Vehicle_Index INTEGER, Day Integer, Time TEXT)"
18#define BUFFER_SIZE 256
19
20int main(int argc, char **argv) {
21
22 sqlite3 * db;
23 sqlite3_stmt * stmt;
24 char * sErrMsg = 0;
25 char * tail = 0;
26 int nRetCode;
27 int n = 0;
28
29 clock_t cStartClock;
30
31 FILE * pFile;
32 char sInputBuf [BUFFER_SIZE] = "