Simple MySQL-C ORM

程序名称:Simple MySQL-C ORM

授权协议: 未知

操作系统: Windows

开发语言: C/C++

Simple MySQL-C ORM 介绍

当你需要在纯C语言的应用程序中访问 MysqL 表中的数据时,是非常繁琐的事情,而该框架可以帮你大量的简化编码的工作,该框架采用 Python 开发,适用于
C 语言程序。

示例代码

#include <db.h>  
#include <stdio.h>  
#include <string.h>  
#include <time.h>


int main (int argc, char **argv)  
{  
    int ret;  
    MysqL global_MysqL;  
    MysqL *m;

    db_ex_customer *cust1;  
    db_ex_item *item1, *item2;

    MysqL_init (& global_MysqL);

    /*  
     * connect to MysqL as usual  
     */  
    m = MysqL_real_connect (& global_MysqL, "localhost", "root", "", "ex1", 3036, NULL, 0);

    /*  
     * pass the MysqL connection to function, that initializes the "ORM"  
     */  
    ret = db_init (& global_MysqL);

    /*  
     * the *__new method creates empty structure  
     */  
    cust1 = db_ex_customer__new ();  
    /*  
     * setting the structure attribute with allocated string,  
     * it will be freed during call of *__free method  
     */  
    cust1->name = strdup ("alesak");

    /*  
     * this methods inserts the structure into according table.  
     * If it has serial field, its value is reflected into structure  
     */  
    ret = db_ex_customer__insert (cust1);

    item1 = db_ex_item__new ();  
    item1->customer_id = cust1->id;  
    item1->itemname = strdup ("simple orm");

    ret = db_ex_item__insert (item1);

    item2 = db_ex_item__new ();  
    item2->customer_id = cust1->id;  
    item2->itemname = strdup ("advanced orm");

    ret = db_ex_item__insert (item2);

    db_ex_customer__free (cust1);  
    db_ex_item__free (item1);  
    db_ex_item__free (item2);

    return (0);  
}

Simple MySQL-C ORM 官网

http://ales.jikos.cz/smorm/

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。