Classes: MySqlConnection, MySqlCommand, MySqlDataReader, TmDateTime
Constructor
MySqlConnection(const std::string &ConnectionString)
Creates MySqlConnection .
ConnectionString :
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword; Socket=unixSocket;Charset=myCharset;
void Ping()
Checks whether the connection to the server is working.
void ChangeDatabase(const std::string &dbname)
Changes the current database for an open MySqlConnection.
MySqlCommand *CreateCommand(const std::string &query)
Creates and returns a MySqlCommand object associated with the MySqlConnection.
size_t ExecuteNonQuery(const std::string &query)
template<typename… Targs>
size_t ExecuteNonQuery(const std::string &query, Targs&& … Fargs)
Executes command against a MySQL database.
Return value:
The number of affected records or number of returner rows in dataset if command returns rows.
template<typename… Targs>
MySqlDataReader *ExecuteReader(const std::string &query, Targs&& … Fargs)
Executes command against a MySQL database.
Return value:
MySqlDataReader object ready to read the results of the command
void BindParam(uint32_t pos, MySqlDbType type)
Binds a type to a corresponding question mark placeholder in the SQL statement that was used to prepare the statement.
void SetNull(uint32_t pos)
Sets NULL to a corresponding question mark placeholder in the SQL statement that was used to prepare the statement.
template<typename T>
void SetValue(uint32_t pos, const T& value)
Sets value to a corresponding question mark placeholder in the SQL statement that was used to prepare the statement. If BindParam was not called for pos sets type according to value.
void SetValue(uint32_t pos, const void *value, size_t length)
Sets value to a corresponding question mark placeholder. Mostly used for BLOB.
template<typename… Targs>
void BindParams(Targs&& … Fargs)
Binds variables to a corresponding question mark placeholders in the SQL statement that was used to prepare the statement.
size_t ExecuteNonQuery()
template<typename… Targs>
size_t ExecuteNonQuery(Targs&& … Fargs)
Executes prepared command against a MySQL database.
Return value:
The number of affected records or number of returner rows in dataset if command returns rows.
MySqlDataReader *ExecuteReader()
template<typename… Targs>
MySqlDataReader *ExecuteReader(Targs&& … Fargs)
Executes prepared command against a MySQL database.
Return value:
MySqlDataReader object ready to read the results of the command
bool Read()
Advances the MySqlDataReader to the next record.
bool IsNull(uint32_t pos) const
bool IsNull(const std::string &name) const
Gets a value indicating whether the column contains non-existent or missing values.
template<typename T>
T GetFieldValue(uint32_t pos) const
template<typename T>
T GetFieldValue(const std::string &name) const
void GetFieldValue(uint32_t pos, void **obuf, uint32_t *olen) const
Gets the value of column.
template<typename… Targs>
void GetValues(Targs&& … Fargs) const
Gets all attribute columns in the collection for the current row.
Nanosecond from 01.01.01.2000 00:00:00
Valid from 22.09.1707 to 10.04.2292
Fields
static const TmDateTime MaxValue;
static const TmDateTime MinValue;
static const TmDateTime Year1900;
static const TmDateTime Year1958;
static const TmDateTime Year1970;
Constructors
TmDateTime()
01.01.01.2000 00:00:00
TmDateTime(const TmDateTime &other)
TmDateTime(int64_t nanoSeconds)
TmDateTime(int year, int month, int day, int hour = 0, int minute = 0, int second = 0,int millisecond = 0, int microsecond = 0,int naonsecond = 0)
Static methods
static TmDateTime FileWriteTime(const std::string &path)
Last file write time
static TmDateTime FromStdTime(std::time_t stdt)
Unix time -> TmDateTime
static TmDateTime Now()
static bool Parse(const std::string &str, TmDateTime *timptr)
static double ToJulianDay(int year, int month, int day, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0)
Methods
tm ToTm()
Returns unix tm structure
std::string ToString()
int64_t Ticks()
Returns ticks – 1ns resolution.
std::time_t epochTime()
Returns unix time
int64_t NetDateTimeTicks()
Returns .NET DateTime ticks – 100 ns resolution
TmDateTime Date()
Gets the date component of this instance.
Returns:
A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).
TmDateTime AddDays(long double value)
TmDateTime AddHours(long double value)
TmDateTime AddMinutes(long double value)
TmDateTime AddSeconds(long double value)
TmDateTime AddMilliseconds(long double value)
TmDateTime AddMicroseconds(long double value)
TmDateTime AddNanoseconds(long double value)
Operators
TmDateTime& operator=(const TmDateTime& other)
bool operator < (const TmDateTime &other)
bool operator > (const TmDateTime &other)
bool operator >= (const TmDateTime &other)
bool operator <= (const TmDateTime &other)
bool operator == (const TmDateTime &other)
bool operator != (const TmDateTime &other)
TmDateTime operator + (const TmDateTime &other)
TmDateTime operator – (const TmDateTime &other)