1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
From: Steve Langasek <vorlon@debian.org>
Subject: switch from using mysql_connect to mysql_real_connect, for MySQL 5.0
--- dbf2mysql-1.14a.orig/mysql2dbf.c
+++ dbf2mysql-1.14a/mysql2dbf.c
@@ -47,7 +47,7 @@
int main(int argc, char **argv) {
int i;
- MYSQL *SQLsock,mysql;
+ MYSQL *SQLsock;
extern int optind;
extern char *optarg;
char *query = NULL;
@@ -148,10 +148,16 @@
printf("Making connection with mySQL-server\n");
}
- if (!(SQLsock = mysql_connect(&mysql,host,user,pass))) {
+ if (!(SQLsock = mysql_init(NULL))) {
+ fprintf(stderr, "Couldn't initialize MySQL handle.\n");
+ close(dbh->db_fd);
+ free(dbh);
+ exit(1);
+ }
+ if (!mysql_real_connect(SQLsock,host,user,pass,NULL,0,NULL,0)) {
fprintf(stderr, "Couldn't get a connection with the ");
fprintf(stderr, "designated host!\n");
- fprintf(stderr, "Detailed report: %s\n", mysql_error(&mysql));
+ fprintf(stderr, "Detailed report: %s\n", mysql_error(SQLsock));
close(dbh->db_fd);
free(dbh);
exit(1);
|