/************************************************************************* * * * YAP Prolog * * * * Yap Prolog was developed at NCCUP - Universidade do Porto * * * * Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 * * * ************************************************************************** * * * File: myddas_mysql.c * * Last rev: 22/03/05 * * mods: * * comments: Predicates for comunicating with a mysql database system * * * *************************************************************************/ #include #include #include /* Auxilary function to table_write*/ static void n_print(Int , char ); /* Auxilary function to table_write*/ static void n_print(Int n, char c) { for(;n>0;n--) printf("%c",c); } void myddas_util_table_write(MYSQL_RES *res_set){ MYSQL_ROW row; MYSQL_FIELD *fields; Int i,f; if (mysql_num_rows(res_set) == 0) { printf ("Empty Set\n"); return; } f = mysql_num_fields(res_set); fields = mysql_fetch_field(res_set); for(i=0;ifields[i].max_length) fields[i].max_length=strlen(fields[i].name); n_print(fields[i].max_length+2,'-'); } printf("+\n"); for(i=0;i