Exemple #1
0
int main(void) {
    curmudgeon_t *      app = NULL;
    event_t *           event = NULL;
    char *              test = "/hello_world/arg1/arg2";
    if ( cur_init(&app,1) == CUR_OK) {
        app->schema_version_file = "schema.version"; 
        adapter_t * a = NULL;
        db_mysql(app,&a,"{ 'host': 'localhost', 'user': '******', 'pass': '******' }");
        db_connect( a );
        db_select_db( a ,"curmudgeon");
        printf("Schema version is: %d\n",_get_num_from_file(app->schema_version_file));
        _set_num_in_file(app->schema_version_file,1); 
        printf("Schema version is: %d\n",_get_num_from_file(app->schema_version_file));
        if ( schema_database(a,"test_table",NULL,NULL) == CUR_OK ) {
            printf("migrated\n");
        } else {
            printf("did not migrate\n");
        }
        _set_num_in_file(app->schema_version_file,0); 
        if ( schema_database( a ,"test_table",NULL,NULL) == CUR_OK ) {
            printf("migrated\n");
        } else {
            printf("did not migrate\n");
        }
        schema_database( a ,"test_table","latin1","latin1_general_ci");
        cur_done(&app);
    } else {
        Puts("Could not init");
    }
    return 0;
}
Exemple #2
0
connect_client* mysql_pool::create_connect()
{
    return NEW db_mysql(*conf_);
}