]> granicus.if.org Git - pdns/commitdiff
fix up mysql & sqlite3 version checking for ancient CentOS 5 versions
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 23 May 2011 19:12:22 +0000 (19:12 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 23 May 2011 19:12:22 +0000 (19:12 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2199 d19b8d6e-7fed-0310-83ef-9ca221ded41b

modules/gmysqlbackend/smysql.cc
modules/gsqlite3backend/ssqlite3.cc

index 61ed5930b9e62026e98154682de3a77965ffcc90..e31bf5055102543033d9f592f9d2095b74ed944e 100644 (file)
@@ -19,16 +19,11 @@ SMySQL::SMySQL(const string &database, const string &host, uint16_t port, const
   my_bool reconnect = 1;
   mysql_options(&d_db, MYSQL_OPT_RECONNECT, &reconnect);
 
-  
-#ifdef MYSQL_OPT_READ_TIMEOUT  
-  unsigned int rtimeout = 10;
-  mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &rtimeout);
-#endif
-#ifdef MYSQL_OPT_WRITE_TIMEOUT
-  unsigned int wtimeout = 10;
-  mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &wtimeout);
+#if MYSQL_VERSION_ID > 51000
+  unsigned int timeout = 10;
+  mysql_options(&d_db, MYSQL_OPT_READ_TIMEOUT, &timeout);
+  mysql_options(&d_db, MYSQL_OPT_WRITE_TIMEOUT, &timeout);
 #endif
-
   
   if (!mysql_real_connect(&d_db, host.empty() ? 0 : host.c_str(), 
                          user.empty() ? 0 : user.c_str(), 
index 1a850b4c80a4389edc3d2fbaacf0a394b4e920c7..f376fc2ccc1acf5b3163f5b9c4a5201c7cf94dbe 100644 (file)
@@ -69,8 +69,13 @@ int SSQLite3::doQuery( const std::string & query )
   const char *pTail;
   // Execute the query.
   
+#if SQLITE_VERSION_NUMBER >=  3003009
   if ( sqlite3_prepare_v2( m_pDB, query.c_str(), -1, &m_pStmt, &pTail ) != SQLITE_OK )
+#else
+  if ( sqlite3_prepare( m_pDB, query.c_str(), -1, &m_pStmt, &pTail ) != SQLITE_OK )   
+#endif
     throw sPerrorException( string("Unable to compile SQLite statement : ")+ sqlite3_errmsg( m_pDB ) );
+
   return 0;
 }