|
From: Andrew T. <ato...@aj...> - 2007-03-01 05:51:59
|
I would like to propose a group of changes.
I have downloaded and made the following changes on my copy.
Overloaded Constructor for Connection object:
Connection();
Connection(const std::string& hostName);
Connection(const std::string& hostName,
const std::string& userName);
Connection(const std::string& hostName,
const std::string& userName,
const std::string& pwd);
Connection(const std::string& hostName,
const std::string& userName,
const std::string& pwd,
unsigned int portNumber);
Connection(const std::string& hostName,
const std::string& userName,
const std::string& pwd,
const std::string& strDatabaseName);
This way the a connection on the heap can be made by using the command
mysqlcppapi::Connection *con = new mysqlcppapi::Connection(
"localhost", "username", "password", "databasename");
This is less wordy then all the lines used to create a connection.
Making connections and queries on the heap brings up another item. But
before I go into that I need to give a reason for this.
The reason to create these things as pointers on the heap is that they
can be created and deleted by the program running them without creating
memory leaks, while keeping the memory footprint to a minimum. The most
important thing is to be able to hold the classes loosely coupled. This
way a query can be made, drop the data into the result set and then be
deleted. This leaves a small memory footprint.
So the problem with this, is the function:
Query Connection::create_Query()
{
return Query(*this);
}
It cannot be overloaded, so the next best thing is:
Query *Connection::create_new_Query()
{
return new Query(*this);
}
Using the function above, a query on the heap can be using the command
mysqlcppapi::Query *query = con->create_new_Query();
Another option is to remove it or go without it, using:
mysqlcppapi::Query *query = new Query(con);
I am going to be making a lot of changes and adding features to my copy
of this API in order to get it to the point where I can use it in a GUI
front end that I hope to be developing. These include adding Doxybook
documentation; transactions; database, table and field discovery
classes, while keeping the classes as simple as possible and loosely
coupled in order to keep them easy to use. I need to know how to
communicate those changes back, as proposals, to the person maintaining
the project.
|