Created
November 27, 2025 21:12
-
-
Save su8/206b94ef740af3866e0045510a5e0603 to your computer and use it in GitHub Desktop.
yt.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sqlite3.h> | |
| #include <iostream> | |
| #include <string> | |
| #include <chrono> | |
| #include <thread> | |
| #include <ctime> | |
| #include <cstdlib> | |
| int main(void) { | |
| sqlite3 *conn; | |
| sqlite3_open("vods.db", &conn); | |
| sqlite3_stmt *stmt; | |
| const char *sql = "UPDATE vods SET upload_status = 'finished', uploaded_at =? WHERE id =?"; | |
| sqlite3_prepare_v2(conn, sql, -1, &stmt, NULL); | |
| auto now = std::chrono::system_clock::now(); | |
| auto now_time_t = std::chrono::system_clock::to_time_t(now); | |
| char now_str[32]; | |
| std::strftime(now_str, 32, "%Y-%m-%d %H:%M:%S", std::localtime(&now_time_t)); | |
| sqlite3_bind_text(stmt, 1, now_str, -1, SQLITE_TRANSIENT); | |
| sqlite3_bind_int(stmt, 2, id); | |
| sqlite3_step(stmt); | |
| sqlite3_finalize(stmt); | |
| sqlite3_close(conn); | |
| return EXIT_SUCCESS; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment