Initial commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef MYSQLCLIENT_H
|
||||
#define MYSQLCLIENT_H
|
||||
|
||||
#include "MySQLResultSet.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace MySQL {
|
||||
|
||||
class MySQLClientImpl;
|
||||
|
||||
class MySQLClient
|
||||
{
|
||||
public:
|
||||
MySQLClient();
|
||||
~MySQLClient();
|
||||
|
||||
void Connect(const std::string& hostname, const std::string& username, const std::string& password);
|
||||
void Connect(const std::string& hostname, const std::string& username, const std::string& password, const std::string& database);
|
||||
void Disconnect();
|
||||
|
||||
std::string Database() const;
|
||||
|
||||
void Execute(const std::string& query) const;
|
||||
MySQLResultSet ExecuteQuery(const std::string& query) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<MySQLClientImpl> m_pMySQLClientImpl;
|
||||
};
|
||||
|
||||
} // namespace MySQL
|
||||
|
||||
#endif // MYSQLCLIENT_H
|
||||
@@ -0,0 +1,91 @@
|
||||
#ifndef MYSQLRESULTSET_H
|
||||
#define MYSQLRESULTSET_H
|
||||
|
||||
#include "MySQLResultSetMetaData.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace MySQL {
|
||||
|
||||
class MySQLResultSetImpl;
|
||||
|
||||
class MySQLResultSet
|
||||
{
|
||||
public:
|
||||
MySQLResultSet();
|
||||
~MySQLResultSet();
|
||||
|
||||
public:
|
||||
bool Absolute(int row);
|
||||
void AfterLast();
|
||||
void BeforeFirst();
|
||||
void CancelRowUpdates();
|
||||
void ClearWarnings();
|
||||
void Close();
|
||||
uint32_t FindColumn(const std::string& columnLabel) const;
|
||||
bool First();
|
||||
std::istream* Blob(uint32_t columnIndex) const;
|
||||
std::istream* Blob(const std::string& columnLabel) const;
|
||||
bool Boolean(uint32_t columnIndex) const;
|
||||
bool Boolean(const std::string& columnLabel) const;
|
||||
int Concurrency();
|
||||
std::string CursorName();
|
||||
long double Double(uint32_t columnIndex) const;
|
||||
long double Double(const std::string& columnLabel) const;
|
||||
int FetchDirection();
|
||||
size_t FetchSize();
|
||||
int Holdability();
|
||||
int32_t Int(uint32_t columnIndex) const;
|
||||
int32_t Int(const std::string& columnLabel) const;
|
||||
uint32_t UInt(uint32_t columnIndex) const;
|
||||
uint32_t UInt(const std::string& columnLabel) const;
|
||||
int64_t Int64(uint32_t columnIndex) const;
|
||||
int64_t Int64(const std::string& columnLabel) const;
|
||||
uint64_t UInt64(uint32_t columnIndex) const;
|
||||
uint64_t UInt64(const std::string& columnLabel) const;
|
||||
MySQLResultSetMetaData MetaData() const;
|
||||
size_t Row() const;
|
||||
//RowID* RowId(uint32_t columnIndex);
|
||||
//RowID* RowId(const std::string & columnLabel);
|
||||
//const Statement* Statement() const;
|
||||
std::string String(uint32_t columnIndex) const;
|
||||
std::string String(const std::string& columnLabel) const;
|
||||
//enum_type Type() const;
|
||||
void Warnings();
|
||||
void InsertRow();
|
||||
bool IsAfterLast() const;
|
||||
bool IsBeforeFirst() const;
|
||||
bool IsClosed() const;
|
||||
bool IsFirst() const;
|
||||
bool IsLast() const;
|
||||
bool IsNull(uint32_t columnIndex) const;
|
||||
bool IsNull(const std::string& columnLabel) const;
|
||||
bool Last();
|
||||
bool Next();
|
||||
void MoveToCurrentRow();
|
||||
void MoveToInsertRow();
|
||||
bool Previous();
|
||||
void RefreshRow();
|
||||
bool Relative(int rows);
|
||||
bool RowDeleted();
|
||||
bool RowInserted();
|
||||
bool RowUpdated();
|
||||
void FetchSize(size_t rows);
|
||||
size_t RowsCount() const;
|
||||
bool WasNull() const;
|
||||
|
||||
private:
|
||||
MySQLResultSet(std::shared_ptr<MySQLResultSetImpl> pMySQLResultSetImpl);
|
||||
|
||||
private:
|
||||
friend class MySQLClient;
|
||||
friend class MySQLClientImpl;
|
||||
|
||||
private:
|
||||
std::shared_ptr<MySQLResultSetImpl> m_pMySQLResultSetImpl;
|
||||
};
|
||||
|
||||
} // namespace MySQL
|
||||
|
||||
#endif // MYSQLRESULTSET_H
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef MYSQLRESULTSETMETADATA_H
|
||||
#define MYSQLRESULTSETMETADATA_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace MySQL {
|
||||
|
||||
class MySQLResultSet;
|
||||
class MySQLResultSetMetaDataImpl;
|
||||
|
||||
class MySQLResultSetMetaData
|
||||
{
|
||||
public:
|
||||
MySQLResultSetMetaData();
|
||||
~MySQLResultSetMetaData();
|
||||
|
||||
public:
|
||||
std::string CatalogName(uint32_t column);
|
||||
uint32_t ColumnCount();
|
||||
uint32_t ColumnDisplaySize(uint32_t column);
|
||||
std::string ColumnLabel(uint32_t column);
|
||||
std::string ColumnName(uint32_t column);
|
||||
int ColumnType(uint32_t column);
|
||||
std::string ColumnTypeName(uint32_t column);
|
||||
uint32_t Precision(uint32_t column);
|
||||
uint32_t Scale(uint32_t column);
|
||||
std::string SchemaName(uint32_t column);
|
||||
std::string TableName(uint32_t column);
|
||||
bool AutoIncrement(uint32_t column);
|
||||
bool CaseSensitive(uint32_t column);
|
||||
bool Currency(uint32_t column);
|
||||
bool DefinitelyWritable(uint32_t column);
|
||||
int Nullable(uint32_t column);
|
||||
bool Numeric(uint32_t column);
|
||||
bool ReadOnly(uint32_t column);
|
||||
bool Searchable(uint32_t column);
|
||||
bool Signed(uint32_t column);
|
||||
bool Writable(uint32_t column);
|
||||
bool Zerofill(uint32_t column);
|
||||
|
||||
private:
|
||||
MySQLResultSetMetaData(std::shared_ptr<MySQLResultSetMetaDataImpl> pMySQLResultSetMetaDataImpl);
|
||||
|
||||
private:
|
||||
friend class MySQLResultSet;
|
||||
friend class MySQLResultSetMetaDataImpl;
|
||||
|
||||
private:
|
||||
std::shared_ptr<MySQLResultSetMetaDataImpl> m_pMySQLResultSetMetaDataImpl;
|
||||
};
|
||||
|
||||
} // namespace MySQL
|
||||
|
||||
#endif // MYSQLRESULTSETMETADATA_H
|
||||
Reference in New Issue
Block a user