C++ Poco::Data::ODBC::Connector














































C++ Poco::Data::ODBC::Connector



class Connector

The Connector class is responsible for connecting components together and for connecting components with the outside world. A Connector creates SessionImpl objects.Every connector library (like the SQLite or the ODBC connector) provides a subclass of this class, an instance of which is registered with the SessionFactory. 
 
Now lets see the constructors and destructors inside this class-
Constructor: A constructor is a member function of a class that has the same name as the class name. It helps to initialize the object of a class.
  Connector();        //creates the Connector

Destructor: A destructor is a member function of a class that destroys the object of a class.It also has the same name as of the class but with a prefix ~.
  ~Connector();        //destroys the Connector

Member Functions

Below are some member functions used in the class Connector-
bindStringToLongVarChar static
static void bindStringToLongVarChar
(
    bool flag = true
);

If set to true (default), std::string is bound to SQL_LONGVARCHAR.
This can cause issues with SQL Server, resulting in an error ("The data types varchar and text are incompatible in the equal to operator") when comparing against a VARCHAR.
Set this to false to bind std::string to SQL_VARCHAR.

NOTE: This is a global setting, affecting all sessions. This setting should not be changed after the first Session has been created.

createSession
Poco::AutoPtr < Poco::Data::SessionImpl > createSession
(
    const std::string & connectionString,
    std::size_t timeout = Poco::Data::SessionImpl::LOGIN_TIMEOUT_DEFAULT
);
Creates a ODBC SessionImpl object and initializes it with the given connectionString.

name virtual inline
const std::string & name() const;
Returns the name associated with this connector.

registerConnector static
static void registerConnector();
Registers the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory

stringBoundToLongVarChar static inline
static bool stringBoundToLongVarChar();
Returns true if std::string is bound to SQL_LONGVARCHAR, otherwise false (bound to SQL_VARCHAR).

unregisterConnector static
static void unregisterConnector();
Unregisters the Connector under the Keyword Connector::KEY at the Poco::Data::SessionFactory

Variables

KEY static
static const std::string KEY;
Keyword for creating ODBC sessions.

Comments