diff --git a/Data/MySQL/Makefile b/Data/MySQL/Makefile index d59ce4660..0c188a8aa 100644 --- a/Data/MySQL/Makefile +++ b/Data/MySQL/Makefile @@ -8,8 +8,8 @@ include $(POCO_BASE)/build/rules/global -SYSLIBS += -L/usr/local/lib/mysql -INCLUDE += -I/usr/local/include/mysql/ +SYSLIBS += -L/usr/local/lib/mysql -L/usr/lib/mysql -L/usr/mysql/lib/mysql +INCLUDE += -I/usr/local/include/mysql/ -I/usr/include/mysql/ -I/usr/mysql/include/mysql SYSFLAGS += -DTHREADSAFE -DNO_TCL objects = Binder Extractor SessionImpl Connector \ diff --git a/Data/MySQL/MySQL_VS90.vcproj b/Data/MySQL/MySQL_VS90.vcproj new file mode 100644 index 000000000..44c322b45 --- /dev/null +++ b/Data/MySQL/MySQL_VS90.vcproj @@ -0,0 +1,278 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Data/MySQL/src/Binder.cpp b/Data/MySQL/src/Binder.cpp index 2ccd6c05d..48f2cd0c3 100644 --- a/Data/MySQL/src/Binder.cpp +++ b/Data/MySQL/src/Binder.cpp @@ -278,7 +278,7 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer size_t s = _bindArray.size(); _bindArray.resize(pos + 1); - memset(&_bindArray[s], 0, sizeof(MYSQL_BIND) * (_bindArray.size() - s)); + std::memset(&_bindArray[s], 0, sizeof(MYSQL_BIND) * (_bindArray.size() - s)); } MYSQL_BIND b = {0}; diff --git a/Data/MySQL/src/ResultMetadata.cpp b/Data/MySQL/src/ResultMetadata.cpp index 9d4c2dc41..88d4efa73 100644 --- a/Data/MySQL/src/ResultMetadata.cpp +++ b/Data/MySQL/src/ResultMetadata.cpp @@ -198,7 +198,7 @@ void ResultMetadata::init(MYSQL_STMT* stmt) {for (size_t i = 0; i < count; i++) { - memset(&_row[i], 0, sizeof(MYSQL_BIND)); + std::memset(&_row[i], 0, sizeof(MYSQL_BIND)); _row[i].buffer_type = fields[i].type; _row[i].buffer_length = static_cast(_columns[i].length()); diff --git a/Data/MySQL/src/SessionImpl.cpp b/Data/MySQL/src/SessionImpl.cpp index 3fe13a92d..4095c4184 100644 --- a/Data/MySQL/src/SessionImpl.cpp +++ b/Data/MySQL/src/SessionImpl.cpp @@ -36,6 +36,7 @@ #include "Poco/Data/MySQL/SessionImpl.h" #include "Poco/Data/MySQL/MySQLStatementImpl.h" +#include "Poco/NumberParser.h" namespace @@ -118,7 +119,8 @@ SessionImpl::SessionImpl(const std::string& connectionString) : _mysql(0), _conn throw MySQLException("create session: specify database"); } - if (atoi(options["port"].c_str()) == 0) + unsigned int port = 0; + if (!NumberParser::tryParseUnsigned(options["port"], port) || 0 == port || port > 65535) { throw MySQLException("create session: specify correct port (numeric in decimal notation)"); } @@ -162,7 +164,7 @@ SessionImpl::SessionImpl(const std::string& connectionString) : _mysql(0), _conn options["user"].c_str(), options["password"].c_str(), options["db"].c_str(), - atoi(options["port"].c_str())); + port); _connected = true; } diff --git a/Data/MySQL/src/StatementExecutor.cpp b/Data/MySQL/src/StatementExecutor.cpp index de2223c09..5da236ed7 100644 --- a/Data/MySQL/src/StatementExecutor.cpp +++ b/Data/MySQL/src/StatementExecutor.cpp @@ -36,6 +36,7 @@ #include #include "Poco/Data/MySQL/StatementExecutor.h" +#include namespace Poco { @@ -179,15 +180,9 @@ bool StatementExecutor::fetchColumn(size_t n, MYSQL_BIND *bind) if ((res != 0) && (res != MYSQL_NO_DATA)) { - std::string msg; - msg += "mysql_stmt_fetch_column("; - - char buff[30]; - sprintf(buff, "%d", n); - msg += buff; - - msg += ") error"; - throw StatementException(msg, h, _query); + std::ostringstream msg; + msg << "mysql_stmt_fetch_column(" << n << ") error"; + throw StatementException(msg.str(), h, _query); } return (res == 0);