Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3BB6E2A6.36689615@wapme-systems.de> Date: Sun, 30 Sep 2001 11:15:18 +0200 From: Stipe Tolj Organization: Wapme Systems AG X-Mailer: Mozilla 4.7 [de]C-CCK-MCD QXW0322b (WinNT; I) X-Accept-Language: de,en MIME-Version: 1.0 CC: cygwin AT cygwin DOT com Subject: Re: Mysql References: <5422002147 DOT 20010929222336 AT frontember DOT hu> Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit > !!!!here is my probe to connect to mysql server!!!! > #include > #include > #include > #include > #include > > #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 AT wapme-systems DOT de ------------------------------------------------------------------- Wapme Systems AG Münsterstr. 248 40470 Düsseldorf Tel: +49-211-74845-0 Fax: +49-211-74845-299 E-Mail: info AT wapme-systems DOT 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/