// MysqlTable.h #ifndef dset__MySqlTable_H #define dset__MySqlTable_H // Chitra Kannan // May 2004 // // MySQL implementation of SqlTable #include "dataset_sql/SqlTable.h" #include "dataset_sql/SelectQuery.h" #include "dataset_sql/InsertQuery.h" #include "dataset_sql/DeleteQuery.h" namespace dset { class MySqlTable : public SqlTable { // Implementation class. class Imp; private: // Data class Imp* m_pimp; public: // inherited methods // Constructor MySqlTable(std::string db_name, std::string host_name, std::string table, std::string user, std::string password); // Destructor virtual ~MySqlTable(); // Is this a valid table. bool is_valid() const; // Return the error code. int error() const; // Return a string describing an error. std::string error_string(int ecode) const; // Fetch the table schema SqlResult get_schema() const; // Fetch the the description of the column holding the modification time. // For now return unix_timestamp(modtime) if modtime exists. std::string modify_time_column() const; // Fetch the the description of the column holding the creation time. // For now return unix_timestamp(cretime) if modtime exists. std::string create_time_column() const; // Fetch the total number of rows. int get_row_count(SelectQuery query =SelectQuery()) const; // Fetch the total number of fiels/Columns. int get_col_count(SelectQuery query =SelectQuery()) const; // Get result of executing Select sql query. // Argument carries the select clause (column names ) as well // as the constraint; not from clause. SqlResult execute_select_query(SelectQuery query =SelectQuery()) const; // Get result of executing Insert sql query. // Argument carries a Row to be inserted. int execute_insert_query(InsertQuery query); // Get result of executing Updated sql query. // Argument carries a id of Row to be updated and new values. int execute_update_query(InsertQuery insquery, SelectQuery selquery); // Get result of executing Delete sql query. // Argument carries the constraint; not from clause. int execute_delete_query(DeleteQuery query =DeleteQuery()); }; } // end dset namespace #endif