19 long parse10(
char const *&p1,
char *&p2,
const char *msg)
21 long v = std::strtol(p1, &p2, 10);
40 long year, month, day;
41 long hour = 0, minute = 0, second = 0;
43 const char *errMsg =
"Cannot convert data to std::tm.";
45 if (strchr(buf,
'-') != NULL)
47 year = parse10(p1, p2, errMsg);
48 month = parse10(p1, p2, errMsg);
49 day = parse10(p1, p2, errMsg);
59 if (strchr(buf,
':') != NULL)
62 hour = parse10(p1, p2, errMsg);
63 minute = parse10(p1, p2, errMsg);
64 second = parse10(p1, p2, errMsg);
68 t.tm_year = year - 1900;
80 char *retv =
new char[2 * len + 3];
82 int len_esc = mysql_real_escape_string(conn, retv + 1, s, len);
83 retv[len_esc + 1] =
'\'';
84 retv[len_esc + 2] =
'\0';
void parse_std_tm(char const *buf, std::tm &t)
char * quote(MYSQL *conn, const char *s, int len)