Subject: Re[2]: Mysql
From: Scr34m <[email-masked]>
To: Michael Hoffman <[email-masked]>
Cc: [email-masked]
Date: Sat, 29 Sep 2001 22:23:36 +0200

Hi Michael,

>> I moved from linux /usr/inclode/mysql files into my cygwin include
>> dir.

MH> Don't do that.

MH> You need libraries for MySQL. Build them from the MySQL source, using:

MH> ./configure --without-server

MH> Of course, you will have to get the native Windows server if you want to
MH> run the server locally.

MH> A caveat: MySQL for Windows uses named pipes to talk to local clients,
MH> whereas the MySQL library you compile will want to use UNIX sockets. I
MH> found the easiest way to get them talking was to always use a host of
MH> 127.0.0.1, forcing INET sockets. Under perl DBI, if you use "localhost,"
MH> somebody decides to be smart and use UNIX sockets anyway.

MH> An additional caveat: There is probably a better way to do the above.
MH> Stipe?

I run mysql under win200 its work i didn't want run under cygwin i
want only write a program wich read tables from 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;
  }
}

---
Bye Scr34m

| www.inertia.hu | www.frontember.hu | eurohack.at.hu |

--
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/