Silgy

MySQL DAO/ORM Classes Generator

This tool generates C++ data access class for MySQL table. It can be used in any C++ project requiring convenient and fast access to MySQL database.

Without DAO class (plain C Connector):

#include <mysql.h> char sql[SQLBUF]; MYSQL_RES *result; MYSQL_ROW row; sprintf(sql, "SELECT name FROM users WHERE id=%d", id); mysql_query(G_dbconn, sql); result = mysql_store_result(G_dbconn); row = mysql_fetch_row(result); if ( row ) printf("Name: %s\n", row[0]?row[0]:""); else printf("Record not found\n"); mysql_free_result(result);

With DAO class:

#include "Cusers.h" static Cusers u; if ( u.Get(id) ) printf("Name: %s\n", u.name); else printf("Record not found\n");

DAO version is also:

When both database and client are on the same server, the latency is a couple of hundreds microseconds. For smaller tables it means that the client process gets the query result in less than millisecond (commodity hardware Linux).

It can also be used together with this generated RESTful API or HTML view. In this case DAO class needs to be generated with C-style strings.

Generator v.1.0.0, last update 2020-04-30 (Beta tests passed)

Paste the CREATE TABLE statement or  
Primary key needs to be defined:


Copyright © 2018–2020 Jurek Muszyński