mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-13 22:50:17 +02:00
[SF 2505290] DB connection as URI (MySQL not tested!)
This commit is contained in:
@@ -98,12 +98,15 @@ public:
|
||||
Poco::Any getInsertId(const std::string&);
|
||||
/// Get insert id
|
||||
|
||||
|
||||
SessionHandle& handle();
|
||||
// Get handle
|
||||
|
||||
const std::string& connectorName();
|
||||
/// Returns the name of the connector.
|
||||
|
||||
private:
|
||||
|
||||
std::string _connector;
|
||||
SessionHandle _mysql;
|
||||
bool _connected;
|
||||
int _inTransaction;
|
||||
@@ -124,11 +127,19 @@ inline Poco::Any SessionImpl::getInsertId(const std::string&)
|
||||
return Poco::Any(Poco::UInt64(mysql_insert_id(_mysql)));
|
||||
}
|
||||
|
||||
|
||||
inline SessionHandle& SessionImpl::handle()
|
||||
{
|
||||
return _mysql;
|
||||
}
|
||||
|
||||
|
||||
inline const std::string& SessionImpl::connectorName()
|
||||
{
|
||||
return _connector;
|
||||
}
|
||||
|
||||
|
||||
} } } // namespace Poco::Data::MySQL
|
||||
|
||||
|
||||
|
@@ -47,7 +47,7 @@ namespace Data {
|
||||
namespace MySQL {
|
||||
|
||||
|
||||
std::string Connector::KEY("MySQL");
|
||||
std::string Connector::KEY("mysql");
|
||||
|
||||
|
||||
Connector::Connector()
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "Poco/Data/MySQL/SessionImpl.h"
|
||||
#include "Poco/Data/MySQL/MySQLStatementImpl.h"
|
||||
#include "Poco/NumberParser.h"
|
||||
#include "Poco/String.h"
|
||||
|
||||
|
||||
namespace
|
||||
@@ -58,7 +59,11 @@ namespace Data {
|
||||
namespace MySQL {
|
||||
|
||||
|
||||
SessionImpl::SessionImpl(const std::string& connectionString) : _mysql(0), _connected(false), _inTransaction(0)
|
||||
SessionImpl::SessionImpl(const std::string& connectionString) :
|
||||
Poco::Data::AbstractSessionImpl<SessionImpl>(toLower(connectionString)),
|
||||
_mysql(0),
|
||||
_connected(false),
|
||||
_inTransaction(0)
|
||||
{
|
||||
addProperty("insertId",
|
||||
&SessionImpl::setInsertId,
|
||||
|
Reference in New Issue
Block a user