File indexing completed on 2025-02-23 05:15:17
0001 // 0002 // Copyright (C) 2004-2006 Maciej Sobczak, Stephen Hutton 0003 // Distributed under the Boost Software License, Version 1.0. 0004 // (See accompanying file LICENSE_1_0.txt or copy at 0005 // http://www.boost.org/LICENSE_1_0.txt) 0006 // 0007 0008 #define SOCI_MYSQL_SOURCE 0009 #include "common.h" 0010 #include <ciso646> 0011 #include <cstdlib> 0012 #include <cstring> 0013 #include <ctime> 0014 0015 char * soci::details::mysql::quote(MYSQL * conn, const char *s, size_t len) 0016 { 0017 char *retv = new char[2 * len + 3]; 0018 retv[0] = '\''; 0019 int len_esc = mysql_real_escape_string(conn, retv + 1, s, static_cast<unsigned long>(len)); 0020 retv[len_esc + 1] = '\''; 0021 retv[len_esc + 2] = '\0'; 0022 0023 return retv; 0024 }