<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: mysql sample code in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874222#M850712</link>
    <description>coding is not a bad job</description>
    <pubDate>Thu, 09 Dec 2004 20:50:18 GMT</pubDate>
    <dc:creator>steven chang_1</dc:creator>
    <dc:date>2004-12-09T20:50:18Z</dc:date>
    <item>
      <title>mysql sample code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874218#M850708</link>
      <description>hello:&lt;BR /&gt;&lt;BR /&gt;  Is anybody write mysql application through it's C API. Would you mind send me the code about insert. Thank you!! Here is the query sample code I write!!&lt;BR /&gt;#include &lt;MYSQL.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  MYSQL mysql;&lt;BR /&gt;  MYSQL_RES *res;&lt;BR /&gt;  MYSQL_ROW row;&lt;BR /&gt;  char *query,*input;&lt;BR /&gt;  int t;&lt;BR /&gt;  unsigned long r;&lt;BR /&gt;  char *insert_value[2];&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   mysql_init(&amp;amp;mysql);&lt;BR /&gt;  if(!mysql_real_connect(&amp;amp;mysql,"localhost","mysql1","mysql1","mysql1",0,NULL,0))&lt;BR /&gt;     printf("Error connecting to database:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;  else&lt;BR /&gt;     printf("Mysql Connected ...\n");&lt;BR /&gt;   query="select * from test1";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error makeing query:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else&lt;BR /&gt;        printf("Query made.....\n");&lt;BR /&gt;   res=mysql_store_result(&amp;amp;mysql);&lt;BR /&gt;   printf("the number rows of result set is %u\n",(unsigned long)mysql_num_rows(res));&lt;BR /&gt;    for(r=0;r&amp;lt;(unsigned long)mysql_num_rows(res);r++)&lt;BR /&gt;       {&lt;BR /&gt;          row=mysql_fetch_row(res);&lt;BR /&gt;           if(row&amp;lt;0) break;&lt;BR /&gt;           for(t=0;t&lt;MYSQL_NUM_FIELDS&gt;&lt;/MYSQL_NUM_FIELDS&gt;            {&lt;BR /&gt;            printf("%s  ",row[t]);&lt;BR /&gt;            insert_value[t]=row[t];&lt;BR /&gt;            }&lt;BR /&gt;            printf("     name is %s, and salary is %d\n",insert_value[0],atoi(insert_value[1]));&lt;BR /&gt;           printf("\n");&lt;BR /&gt;       }&lt;BR /&gt;     mysql_free_result(res);&lt;BR /&gt;     mysql_close(&amp;amp;mysql);&lt;BR /&gt;}&lt;BR /&gt;        &lt;BR /&gt;&lt;/STDIO.H&gt;&lt;/MYSQL.H&gt;</description>
      <pubDate>Tue, 07 Dec 2004 04:31:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874218#M850708</guid>
      <dc:creator>steven chang_1</dc:creator>
      <dc:date>2004-12-07T04:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: mysql sample code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874219#M850709</link>
      <description>If you go onto the MYSQL site you should find what you're looking for :&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dev.mysql.com/doc/mysql/en/mysql_info.html" target="_blank"&gt;http://dev.mysql.com/doc/mysql/en/mysql_info.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://dev.mysql.com/doc/mysql/en/mysql_affected_rows.html" target="_blank"&gt;http://dev.mysql.com/doc/mysql/en/mysql_affected_rows.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dev.mysql.com/doc/mysql/en/libmysqld_example.html" target="_blank"&gt;http://dev.mysql.com/doc/mysql/en/libmysqld_example.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Jean-Luc</description>
      <pubDate>Tue, 07 Dec 2004 07:11:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874219#M850709</guid>
      <dc:creator>Jean-Luc Oudart</dc:creator>
      <dc:date>2004-12-07T07:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: mysql sample code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874220#M850710</link>
      <description>hi:&lt;BR /&gt;&lt;BR /&gt;   I was misleading by the function name "mysql_real_query". You could use insert,delete, update, select for this function.The follwoing is the sample code for insert, update.&lt;BR /&gt;&lt;BR /&gt;#include &lt;MYSQL.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  MYSQL mysql;&lt;BR /&gt;  MYSQL_RES *res;&lt;BR /&gt;  MYSQL_ROW row;&lt;BR /&gt;  char *query;&lt;BR /&gt;  int t;&lt;BR /&gt;  unsigned long r;&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;   mysql_init(&amp;amp;mysql);&lt;BR /&gt;  if(!mysql_real_connect(&amp;amp;mysql,"localhost","mysql1","mysql1","mysql1",0,NULL,0))&lt;BR /&gt;     printf("Error connecting to database:%s\n",mysql_error(&amp;amp;mysql)); &lt;BR /&gt;  else &lt;BR /&gt;     printf("Mysql Connected ...\n");&lt;BR /&gt;   query="insert into test values('insert')";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making insert table test:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Insert made.to test table....\n");&lt;BR /&gt;   query="update test set name='update' where name='insert'";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making update table test:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Update made.to test table....\n");&lt;BR /&gt;   query="select * from test";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error makeing query:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Query made.....\n");&lt;BR /&gt;   res=mysql_store_result(&amp;amp;mysql);&lt;BR /&gt;   printf("the number rows of result set is %u\n",(unsigned long)mysql_num_rows(res));&lt;BR /&gt;    for(r=0;r&amp;lt;(unsigned long)mysql_num_rows(res);r++)&lt;BR /&gt;       {&lt;BR /&gt;          row=mysql_fetch_row(res);&lt;BR /&gt;           if(row&amp;lt;0) break;&lt;BR /&gt;           for(t=0;t&lt;MYSQL_NUM_FIELDS&gt;&lt;/MYSQL_NUM_FIELDS&gt;            printf("%s  ",row[t]);&lt;BR /&gt;           printf("\n");&lt;BR /&gt;       }&lt;BR /&gt;     mysql_free_result(res);&lt;BR /&gt;     mysql_close(&amp;amp;mysql);&lt;BR /&gt;}&lt;/STDIO.H&gt;&lt;/MYSQL.H&gt;</description>
      <pubDate>Tue, 07 Dec 2004 21:34:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874220#M850710</guid>
      <dc:creator>steven chang_1</dc:creator>
      <dc:date>2004-12-07T21:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: mysql sample code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874221#M850711</link>
      <description>transactional table syntax:&lt;BR /&gt;&lt;BR /&gt;#include &lt;MYSQL.H&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  MYSQL mysql;&lt;BR /&gt;  MYSQL_RES *res;&lt;BR /&gt;  MYSQL_ROW row;&lt;BR /&gt;  char *query;&lt;BR /&gt;  int t;&lt;BR /&gt;  unsigned long r;&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;   mysql_init(&amp;amp;mysql);&lt;BR /&gt;  if(!mysql_real_connect(&amp;amp;mysql,"localhost","mysql1","mysql1","mysql1",0,NULL,0))&lt;BR /&gt;     printf("Error connecting to database:%s\n",mysql_error(&amp;amp;mysql)); &lt;BR /&gt;  else &lt;BR /&gt;     printf("Mysql Connected ...\n");&lt;BR /&gt;/*   query="insert into test values('insert')";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making insert table test:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Insert made.to test table....\n");&lt;BR /&gt;   query="update test set name='update' where name='insert'";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making update table test:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Update made.to test table....\n"); */&lt;BR /&gt;//   query="start transaction";&lt;BR /&gt;   query="set autocommit=0";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making start transactions:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Transaction start.....\n");&lt;BR /&gt;   query="delete from test where name='å¼µå  ç  '";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making delete operation:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Delete made.....\n");&lt;BR /&gt;   query="delete from test1 where name='å¼µå  ç  '";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making delete operation:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Delete made.....\n");&lt;BR /&gt;   query="rollback";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making rollback operation:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Rollback delete made.....\n");&lt;BR /&gt;   query="select * from test1";&lt;BR /&gt;   t=mysql_real_query(&amp;amp;mysql,query,(unsigned int)strlen(query));&lt;BR /&gt;   if(t)&lt;BR /&gt;        printf("Error making query:%s\n",mysql_error(&amp;amp;mysql));&lt;BR /&gt;   else &lt;BR /&gt;        printf("Query made.....\n");&lt;BR /&gt;   res=mysql_store_result(&amp;amp;mysql);&lt;BR /&gt;   printf("the number rows of result set is %u\n",(unsigned long)mysql_num_rows(res));&lt;BR /&gt;    for(r=0;r&amp;lt;(unsigned long)mysql_num_rows(res);r++)&lt;BR /&gt;       {&lt;BR /&gt;          row=mysql_fetch_row(res);&lt;BR /&gt;           if(row&amp;lt;0) break;&lt;BR /&gt;           for(t=0;t&lt;MYSQL_NUM_FIELDS&gt;&lt;/MYSQL_NUM_FIELDS&gt;            printf("%s  ",row[t]);&lt;BR /&gt;           printf("\n");&lt;BR /&gt;       }&lt;BR /&gt;     mysql_free_result(res);&lt;BR /&gt;     mysql_c&lt;/STDIO.H&gt;&lt;/MYSQL.H&gt;</description>
      <pubDate>Thu, 09 Dec 2004 20:49:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874221#M850711</guid>
      <dc:creator>steven chang_1</dc:creator>
      <dc:date>2004-12-09T20:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: mysql sample code</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874222#M850712</link>
      <description>coding is not a bad job</description>
      <pubDate>Thu, 09 Dec 2004 20:50:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mysql-sample-code/m-p/4874222#M850712</guid>
      <dc:creator>steven chang_1</dc:creator>
      <dc:date>2004-12-09T20:50:18Z</dc:date>
    </item>
  </channel>
</rss>

