User Tools

Site Tools


c:mysql:mysql.h:mysql_info

Differences

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

Link to this comparison view

c:mysql:mysql.h:mysql_info [2013/02/26 00:34]
Daniel Gohlke
c:mysql:mysql.h:mysql_info [2024/02/16 01:12] (current)
Line 3: Line 3:
 const char *mysql_info(MYSQL *mysql) const char *mysql_info(MYSQL *mysql)
 </code> </code>
 +
  
 ==== description of mysql_info ==== ==== description of mysql_info ====
-mysql_info is in work by code-reference.com \\  +A character string containing additional information about the most recent queryNULL if no information about the request are available.
-if you are faster... don't hasitate and add it+
  
 +
 +compile with gcc mysql_info.c -o mysql_info `mysql_config –cflags –libs` -Wall 
 <code c> <code c>
-no example at the moment+#include <stdio.h> /* including standard library */  
 +#include <mysql/mysql.h> 
 +  
 +MYSQL *my; 
 +  
 +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, "INSERT INTO `test`.`collection`" 
 +         " (`id`, `name`, `title`, `published`)" 
 + " VALUES (NULL, 'Demian', 'Debian 6.0', '2013-02-14');"); 
 + 
 +printf("MySQL Info: %s\n", mysql_info(my)); 
 + 
 +mysql_query(my, "UPDATE `test`.`collection`" 
 +         " SET name = 'Debian'" 
 + " WHERE `name` LIKE 'Demian';"); 
 +printf("MySQL Info: %s\n", mysql_info(my)); 
 + 
 +mysql_close(my); 
 +return 0; 
 +}
 </code> </code>
  
 +
 +=== db for this mysql_info example===
 +<file test.sql sql>
 +--
 +-- Database: `test`
 +--
 +CREATE DATABASE `test` DEFAULT CHARACTER SET latin1 COLLATE utf8_general_ci;
 +USE `test`;
 +
 +-- --------------------------------------------------------
 +
 +--
 +-- Tablestructure for Table `collection`
 +--
 +
 +CREATE TABLE IF NOT EXISTS `collection` (
 +  `id` int(11) NOT NULL AUTO_INCREMENT,
 +  `name` varchar(90) NOT NULL,
 +  `title` varchar(255) NOT NULL,
 +  `published` date NOT NULL,
 +  PRIMARY KEY (`id`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 +
 +</file>
 ===== output of mysql_info c example ===== ===== output of mysql_info c example =====
-    no example at the moment+    Login correct 
 +    MySQL Info: (null) 
 +    MySQL Info: Rows matched: 1 Changed: 1 Warnings: 0
  

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/mysql/mysql.h/mysql_info.txt · Last modified: 2024/02/16 01:12 (external edit)

Impressum Datenschutz