Using C ++ (Visual Studio) and sqlite. How to associate a date with a parameter?
sqlite3_stmt *statement; const char *sql = "INSERT INTO employees " "(full_name," "date_started)" " VALUES " "(@full_name," "@date_started)"; sqlite3_prepare_v2(database_, sql, -1, &statement, NULL); int parameterIndex = sqlite3_bind_parameter_index(statement, "@full_name"); sqlite3_bind_text(statement, parameterIndex, "John Smith", -1, SQLITE_TRANSIENT); parameterIndex = sqlite3_bind_parameter_index(statement, "@date_started"); // <??? what goes here ???> // I want to include the local current time, so I want to know: // 1. what the best way to get local time in C++ // 2. and what goes here for the date binding sqlite3_step(statement); sqlite3_finalize(statement);
Note. I do not want to set the current time using sql (e.g. CURRENT_TIMESTAMP, etc.).
source share