Example #1
0
void MySQLClient::setup(Host& host, const string& user, const string& password, const string& db) //Setup connection, make DNS Req if necessary
{
  init(); //Initialize client in known state, create socket
  resetTimeout();
  m_host = host;
  if(!host.getPort())
    host.setPort( MYSQL_PORT ); //Default port
    
  m_user = user;
  m_password = password;
  
  m_db = db;

  if( !host.getIp().isNull() )
  {
    connect();
  }
  else //Need to do a DNS Query...
  {
    DBG("DNS Query...\n");
    m_pDnsReq = new DNSRequest();
    m_pDnsReq->setOnReply(this, &MySQLClient::onDNSReply);
    m_pDnsReq->resolve(&m_host);
    DBG("MySQLClient : DNSRequest %p\n", m_pDnsReq);
  }
}