I wanted to use mysql_real_escape_string to handle apostrophe, backslashes etc. I searched and found this function
unsigned long mysql_real_escape_string(MYSQL *mysql, 
     char *to, const char *from, unsigned long length)
But this takes MYSQL *, but I use this code to connect :
        sql::Driver *driver;
        sql::Connection *con;
        sql::Statement *stmt;
        // Create a connection
        driver = get_driver_instance();
        con = driver->connect("tcp://127.0.0.1:3306", "root", "anubha");
        con->setSchema("db");
        stmt = con->createStatement(); 
So if I don't have a MYSQL *mysql object as the function requires. If I do connection like this :
         MYSQL* conn = mysql_init(NULL);
          mysql_real_connect(conn,"tcp://127.0.0.1:3306", "root", 
          "anubha", "db" ,0,NULL,0);
Then as I have MYSQL* object I can use the function, but should I change the connection code just to use this function. Isn't there another function available ? Also what is the difference between the 2 ways to connect, is it C vs C++ mysql connector api difference ?
 
    