Commit 123f7518 authored by jan.koester's avatar jan.koester
Browse files

test

parent 2368798e
Loading
Loading
Loading
Loading
+5 −8
Changes for plugins/content/content.cpp: 5 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -295,16 +295,13 @@ namespace blogi {

                int author=atoi(ares[0][0]);

                char ttmp[26];
                std::chrono::system_clock::time_point t = std::chrono::system_clock::now();


                try {
                    std::time_t time_t_value = std::chrono::system_clock::to_time_t(t);
                std::string time_str;

                try {
                        time_str = std::format("{:%a %b %d %H:%M:%S %Y}", t);
                    auto now = std::chrono::system_clock::now();
                    auto local_now = std::chrono::zoned_time{std::chrono::current_zone(), now};
                    try {
                        time_str = std::format("{:%a %b %d %H:%M:%S %Y %z}", t);
                    } catch (...) {
                        throw excep[libhttppp::HTTPException::Error] << "Cannot get Time (std::format/put_time failed)!";
                    }
@@ -318,7 +315,7 @@ namespace blogi {
                sql << "INSERT INTO content (title,descrition,text,author,created) VALUES ('" <<
                dbpp::SQL::escaped(sbuf,title.data()) << "','" <<
                dbpp::SQL::escaped(sbuf,description.data()) <<"','" <<
                dbpp::SQL::escaped(sbuf,text.data()) <<"','"<< author <<"','" << ttmp << "') RETURNING id;";
                dbpp::SQL::escaped(sbuf,text.data()) <<"','"<< author <<"','" << time_str.c_str() << "') RETURNING id;";

                try {
                    Args->database[tid]->exec(sql,res);