This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Mysql



> !!!!here is my probe to connect to mysql server!!!!
> #include <stdio.h>
> #include <mysql/mysql.h>
> #include <string.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> #define LEN_SERV   60
> #define LEN_LOGIN  16
> #define LEN_TABLE  64
> 
> char   *SVname, *Cuser, *Cpass, *Dname, *TBname, *DefDom;
> int Port_num=0;
> char *Socket_file=NULL;
> 
> #define LEN_BUFFER LEN_TABLE+20
> 
> int    mysql_keepopen=1;
> int    mysql_acct_keepopen;
> int    mysql_use=1;
> int     check_host=0;
> int    check_quota=0;
> 
> int    myAUTH_ignore_validity=0;
> 
> MYSQL  real_mysql, *mysql = NULL;
> MYSQL_RES      *result;
> 
> int main(){
> 
>   return(0);
> }
> 
> /**********************************************/
> /**********************************************/
> /**********************************************/
> int Mysql_Reconnect(){
>   int i ;
> 
>   if (!(mysql=mysql_connect(&real_mysql, "127.0.0.1", "root", ""))) {
>     mysql = NULL;
>   } else {
>           mysql = &real_mysql;
>   }
>   i++;
>   sleep(3);
> 
>   if (mysql != NULL) {
>     mysql_select_db(mysql, Dname);
>   }
> }
> 
> /*******************************/
> void
> My_Mysql_Close(int keepopen_flag)
> {
>   if(keepopen_flag == 0) {
>     /* Close the connection after each record */
>     if (mysql != NULL) {
>       mysql_close(mysql);
>     }
>     mysql = NULL;
>   }
> }

that seems ok (at a first glimpse), but you have to link against
libmysqlclient.a while linking this test program, i.e.

  $ gcc -o foo -c foo.c -L/usr/local/lib/mysql -lmysqlclient

because the mysql_xxx() functions are implemented there.


Stipe

tolj@wapme-systems.de
-------------------------------------------------------------------
Wapme Systems AG

Münsterstr. 248
40470 Düsseldorf

Tel: +49-211-74845-0
Fax: +49-211-74845-299

E-Mail: info@wapme-systems.de
Internet: http://www.wapme-systems.de
-------------------------------------------------------------------
wapme.net - wherever you are

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]