Commit fd196172 authored by Pavel Vainerman's avatar Pavel Vainerman

(DB): немного подправил h-файл (убрал using std::string)

parent 5e56e5e3
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <sstream> #include <sstream>
#include "DBInterface.h" #include "DBInterface.h"
using namespace std; using namespace std;
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
DBInterface::DBInterface(): DBInterface::DBInterface():
...@@ -192,7 +191,7 @@ bool DBInterface::dropDB(const string dbname) ...@@ -192,7 +191,7 @@ bool DBInterface::dropDB(const string dbname)
MYSQL_RES* DBInterface::listFields(const string table, const string wild ) MYSQL_RES* DBInterface::listFields(const string table, const string wild )
{ {
if( !mysql || !result ) if( !mysql || !result )
return false; return 0;
MYSQL_RES *res = mysql_list_fields(mysql, table.c_str(),wild.c_str()); MYSQL_RES *res = mysql_list_fields(mysql, table.c_str(),wild.c_str());
unsigned int cols = mysql_num_fields(result); // numCols(); unsigned int cols = mysql_num_fields(result); // numCols();
...@@ -205,7 +204,7 @@ MYSQL_RES* DBInterface::listFields(const string table, const string wild ) ...@@ -205,7 +204,7 @@ MYSQL_RES* DBInterface::listFields(const string table, const string wild )
cout << row[i] << " | "; cout << row[i] << " | ";
} }
return res; // mysql_list_fields(mysql, table,wild); return res; // mysql_list_fields(mysql, table,wild);
} }
// ----------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------
bool DBInterface::moveToRow(int ind) bool DBInterface::moveToRow(int ind)
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
//#warning Для использования mysql_create нужен define USE_OLD_FUNCTIONS //#warning Для использования mysql_create нужен define USE_OLD_FUNCTIONS
//#define USE_OLD_FUNCTIONS //#define USE_OLD_FUNCTIONS
#include <mysql/mysql.h> #include <mysql/mysql.h>
using std::string;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class DBInterface class DBInterface
{ {
...@@ -38,20 +37,20 @@ class DBInterface ...@@ -38,20 +37,20 @@ class DBInterface
DBInterface(); DBInterface();
~DBInterface(); ~DBInterface();
// bool createDB(const string dbname); // bool createDB(const std::string dbname);
// bool dropDB(const string dbname); // bool dropDB(const std::string dbname);
MYSQL_RES * listFields(const string table, const string wild ); MYSQL_RES * listFields(const std::string table, const std::string wild );
bool connect( const string host, const string user, const string pswd, bool connect( const std::string host, const std::string user, const std::string pswd,
const string dbname); const std::string dbname);
bool close(); bool close();
bool query(const string q); bool query(const std::string q);
const string lastQuery(); const std::string lastQuery();
bool insert(const string q); bool insert(const std::string q);
string addslashes(const string& str); std::string addslashes(const std::string& str);
/*! /*!
проверка связи с БД. проверка связи с БД.
...@@ -73,7 +72,7 @@ class DBInterface ...@@ -73,7 +72,7 @@ class DBInterface
int insert_id(); int insert_id();
const MYSQL_ROW getRow(); const MYSQL_ROW getRow();
const string error(); const std::string error();
MYSQL_ROW Row; MYSQL_ROW Row;
...@@ -85,7 +84,7 @@ class DBInterface ...@@ -85,7 +84,7 @@ class DBInterface
MYSQL_RES *result; MYSQL_RES *result;
MYSQL *mysql; MYSQL *mysql;
string lastQ; std::string lastQ;
bool queryok; // успешность текущего запроса bool queryok; // успешность текущего запроса
bool connected; bool connected;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment