44
44
#include <drizzled/configmake.h>
45
45
#include <drizzled/error.h>
46
46
#include <boost/program_options.hpp>
47
#include <boost/regex.hpp>
49
49
using namespace std;
50
50
using namespace drizzled;
2412
2412
int get_server_type()
2414
const char *pcre_error;
2415
int32_t pcre_error_offset;
2419
pcre *mysql_regex= pcre_compile("5\\.[0-9]+\\.[0-9]+", 0, &pcre_error, &pcre_error_offset, NULL);
2422
fprintf(stderr, _("Error compiling regex (offset: %d), %s\n"));
2426
pcre *drizzle_regex= pcre_compile("20[0-9]{2}\\.(0[1-9]|1[012])\\.[0-9]+", 0, &pcre_error, &pcre_error_offset, NULL);
2429
fprintf(stderr, _("Error compiling regex (offset: %d), %s\n"));
2414
boost::match_flag_type flags = boost::match_default;
2416
boost::regex mysql_regex("(5\\.[0-9]+\\.[0-9]+)");
2417
boost::regex drizzle_regex("(20[0-9]{2}\\.(0[1-9]|1[012])\\.[0-9]+)");
2433
2419
std::string version(drizzle_con_server_version(&dcon));
2435
pcre_match= pcre_exec(mysql_regex, 0, version.c_str(), version.length(), 0, 0, ovector, 9);
2437
if (pcre_match >= 0)
2421
if (regex_search(version, mysql_regex, flags))
2438
2422
return SERVER_MYSQL_FOUND;
2440
pcre_match= pcre_exec(drizzle_regex, 0, version.c_str(), version.length(), 0, 0, ovector, 9);
2442
if (pcre_match >= 0)
2424
if (regex_search(version, drizzle_regex, flags))
2443
2425
return SERVER_DRIZZLE_FOUND;
2445
2427
return SERVER_UNKNOWN_FOUND;