User Tools

Site Tools


c:mysql:mysql.h:mysql_fetch_fields

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:mysql:mysql.h:mysql_fetch_fields [2013/02/03 20:19]
127.0.0.1 external edit
c:mysql:mysql.h:mysql_fetch_fields [2013/03/01 01:07] (current)
Daniel Gohlke [output of mysql_fetch_fields c example]
Line 1: Line 1:
 ====== mysql_fetch_fields ====== ====== mysql_fetch_fields ======
 <code c> <code c>
 +MYSQL_FIELD *mysql_fetch_fields(MYSQL_RES *result) 
 </code> </code>
  
 ==== description of mysql_fetch_fields ==== ==== description of mysql_fetch_fields ====
-mysql_fetch_fields is in work by code-reference.com \\  +mysql_fetch_fields provides an array of information about the fields in a amount of result
-if you are faster... don't hasitate and add it+
  
 <code c> <code c>
-no example at the moment+#include <stdio.h> /* including standard library */  
 +#include <mysql/mysql.h> 
 +  
 +MYSQL *my; 
 +MYSQL_RES *result; 
 +MYSQL_FIELD *fields; 
 + 
 +int main( void ) 
 +
 + 
 +char host[20]; 
 +char user[20]; 
 +char pass[20]; 
 + 
 +my = mysql_init(NULL); 
 + 
 +sprintf(host,"localhost"); 
 +sprintf(user,"username"); 
 +sprintf(pass,"password"); 
 +  
 +if (my == NULL ) { 
 +printf("Cant initalisize MySQL\n"); 
 +return 1; 
 +
 +  
 +if( mysql_real_connect (my,host,user,pass,NULL,0,NULL,0)  == NULL) { 
 +  printf("Error cant login\n"); 
 +  } else { 
 +  printf("Login correct\n"); 
 +  } 
 + 
 + 
 +mysql_select_db(my, "test"); 
 + 
 +mysql_query(my, "SELECT * FROM collection LIMIT 1;"); 
 +result = mysql_store_result( my ); 
 + 
 +fields = mysql_fetch_fields(result); 
 + 
 +  printf("name %s \t\t", fields->name); 
 +  printf("name_length: %i\n", fields->name_length); 
 + 
 +/* 
 +  printf("fields->org_name %s\n", fields->org_name); 
 +  printf("fields->org_name_length %i\n", fields->org_name_length); 
 + 
 +  printf("fields->table %s\n", fields->table); 
 +  printf("fields->table_length %i\n", fields->table_length); 
 + 
 +  printf("fields->org_table %s\n", fields->org_table); 
 +  printf("fields->org_table_length %i\n", fields->org_table_length); 
 + 
 +  printf("fields->db %s\n", fields->db); 
 +  printf("fields->db_length %i\n", fields->db_length); 
 + 
 +  printf("fields->catalog %s\n", fields->catalog); 
 +  printf("fields->catalog_length %i\n", fields->catalog_length); 
 + 
 +  printf("fields->def %s\n", fields->def); 
 +  printf("fields->def_length %i\n", fields->def_length); 
 + 
 +  printf("fields->length %li\n", fields->length); // unsigned long 
 +  printf("fields->max_length %li\n", fields->max_length); // unsigned long 
 + 
 +  printf("fields->flags %u\n", fields->flags); // unsigned long 
 +*/ 
 + 
 + 
 +mysql_close(my); 
 +return 0; 
 +}
 </code> </code>
  
 ===== output of mysql_fetch_fields c example ===== ===== output of mysql_fetch_fields c example =====
-    no example at the moment +    Login correct 
 +    name id            name_lenght: 2
advertising
c/mysql/mysql.h/mysql_fetch_fields.1359919178.txt · Last modified: 2013/02/25 23:36 (external edit)

Impressum Datenschutz