C API : Problem using multi-statements

2005-05-06 Thread ganjineh
Hello,

I have some problems using multiple queries in a databased driven project, 
therefore I wrote a little testprogram which  
causes the same problems. 

I am using the C-API of MySQL 4.1.11 on a Gentoo Linux 3.3.2-r5, 
propolice-3.3-7 with 2.4.27 kernel.
I connect to the server (on localhost) with mysql_real_connect and the flag 
CLIENT_MULTI_STATEMENTS, 
I submit multiple queries (two INSERTS seperated by ;) on the existing 
connection. 
Executing the multistatement with mysql_query in a loop (i.e. 10 times), 
I get a lot of lost connection during query errors, but sending a single 
INSERT query in a loop causes no errors !!!

Thanks in advance for help
regards Tinosch Ganjineh


The following program operates on a simple table structure created with the 
following statement :
CREATE TABLE BIGTABLE (myoid char(40), mykey char(40), myval char(40), myint 
bigint) TYPE = InnoDB; 

/** mysqltest.cpp 
*/
#include iostream
#include mysql.h
#include sstream
#include string

using namespace std;

string itos(long long i) {
  ostringstream sstream;
  sstream  i;
  return sstream.str();
}

int main(int argc, char** argv) {
    MYSQL* conn;
    if(conn = mysql_init(NULL)) {
      if(mysql_real_connect(conn, localhost, root, x, test, 0, 
NULL, CLIENT_MULTI_STATEMENTS )) {
        int loop=100;
        for(int i=0; iloop; ++i) {
          int e=0;
          string query;
          query = string(INSERT INTO BIGTABLE VALUES () + 'object- 
+itos(i)+', 'foo', 'bar', NULL);\
          INSERT INTO BIGTABLE VALUES ( + 'object- +itos(i+1000)+', 'bar, 
'foo', NULL);
          e = mysql_query(conn, query.c_str());
          if(e) {
            cerr  *Query failed*:   e   -   
mysql_error(conn)  endl;
          } else {
             MYSQL_RES* result = mysql_store_result(conn);
             if(result) {
               // .. parse result set ... 
            } else {
               //cerr  Could not fetch Results from DB:   
mysql_error(conn);
          }
          mysql_free_result(result);
        }
      }
    } else {
      cerr  Could not connect to MySQL database:   mysql_error(conn)  
endl;
    }  
   } else {
      cerr  Could not initialize MySQL:   mysql_error(conn)  endl;
   }
}
/** mysqltest.cpp 
*/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: C API : Problem using multi-statements

2005-05-06 Thread Jeremiah Gowdy
Answer is simple.  Can't do that.
- Original Message - 
From: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Friday, May 06, 2005 5:40 AM
Subject: C API : Problem using multi-statements

Hello,
I have some problems using multiple queries in a databased driven project, 
therefore I wrote a little testprogram which
causes the same problems.

I am using the C-API of MySQL 4.1.11 on a Gentoo Linux 3.3.2-r5, 
propolice-3.3-7 with 2.4.27 kernel.
I connect to the server (on localhost) with mysql_real_connect and the flag 
CLIENT_MULTI_STATEMENTS,
I submit multiple queries (two INSERTS seperated by ;) on the existing 
connection.
Executing the multistatement with mysql_query in a loop (i.e. 10 times),
I get a lot of lost connection during query errors, but sending a single 
INSERT query in a loop causes no errors !!!

Thanks in advance for help
regards Tinosch Ganjineh
The following program operates on a simple table structure created with the 
following statement :
CREATE TABLE BIGTABLE (myoid char(40), mykey char(40), myval char(40), myint 
bigint) TYPE = InnoDB;

/** mysqltest.cpp 
*/
#include iostream
#include mysql.h
#include sstream
#include string

using namespace std;
string itos(long long i) {
ostringstream sstream;
sstream  i;
return sstream.str();
}
int main(int argc, char** argv) {
MYSQL* conn;
if(conn = mysql_init(NULL)) {
if(mysql_real_connect(conn, localhost, root, x, test, 0, NULL, 
CLIENT_MULTI_STATEMENTS )) {
int loop=100;
for(int i=0; iloop; ++i) {
int e=0;
string query;
query = string(INSERT INTO BIGTABLE VALUES () + 'object- +itos(i)+', 
'foo', 'bar', NULL);\
INSERT INTO BIGTABLE VALUES ( + 'object- +itos(i+1000)+', 'bar, 'foo', 
NULL);
e = mysql_query(conn, query.c_str());
if(e) {
cerr  *Query failed*:   e   -   mysql_error(conn)  
endl;
} else {
MYSQL_RES* result = mysql_store_result(conn);
if(result) {
// .. parse result set ...
} else {
//cerr  Could not fetch Results from DB:   mysql_error(conn);
}
mysql_free_result(result);
}
}
} else {
cerr  Could not connect to MySQL database:   mysql_error(conn)  
endl;
}
} else {
cerr  Could not initialize MySQL:   mysql_error(conn)  endl;
}
}
/** mysqltest.cpp 
*/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: C API : Problem using multi-statements

2005-05-06 Thread Reggie Burnett
Jeremiah

I don't use the client library in my work but this should work from 4.1 on.

-Reggie 

-Original Message-
From: Jeremiah Gowdy [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 06, 2005 11:19 AM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: C API : Problem using multi-statements

Answer is simple.  Can't do that.

- Original Message -
From: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Friday, May 06, 2005 5:40 AM
Subject: C API : Problem using multi-statements


Hello,

I have some problems using multiple queries in a databased driven project, 
therefore I wrote a little testprogram which
causes the same problems.

I am using the C-API of MySQL 4.1.11 on a Gentoo Linux 3.3.2-r5, 
propolice-3.3-7 with 2.4.27 kernel.
I connect to the server (on localhost) with mysql_real_connect and the flag 
CLIENT_MULTI_STATEMENTS,
I submit multiple queries (two INSERTS seperated by ;) on the existing 
connection.
Executing the multistatement with mysql_query in a loop (i.e. 10 times),
I get a lot of lost connection during query errors, but sending a single 
INSERT query in a loop causes no errors !!!

Thanks in advance for help
regards Tinosch Ganjineh


The following program operates on a simple table structure created with the 
following statement :
CREATE TABLE BIGTABLE (myoid char(40), mykey char(40), myval char(40), myint

bigint) TYPE = InnoDB;

/** mysqltest.cpp 
*/
#include iostream
#include mysql.h
#include sstream
#include string

using namespace std;

string itos(long long i) {
ostringstream sstream;
sstream  i;
return sstream.str();
}

int main(int argc, char** argv) {
MYSQL* conn;
if(conn = mysql_init(NULL)) {
if(mysql_real_connect(conn, localhost, root, x, test, 0, NULL, 
CLIENT_MULTI_STATEMENTS )) {
int loop=100;
for(int i=0; iloop; ++i) {
int e=0;
string query;
query = string(INSERT INTO BIGTABLE VALUES () + 'object- +itos(i)+', 
'foo', 'bar', NULL);\
INSERT INTO BIGTABLE VALUES ( + 'object- +itos(i+1000)+', 'bar, 'foo', 
NULL);
e = mysql_query(conn, query.c_str());
if(e) {
cerr  *Query failed*:   e   -   mysql_error(conn) 

endl;
} else {
MYSQL_RES* result = mysql_store_result(conn);
if(result) {
// .. parse result set ...
} else {
//cerr  Could not fetch Results from DB:   mysql_error(conn);
}
mysql_free_result(result);
}
}
} else {
cerr  Could not connect to MySQL database:   mysql_error(conn)  
endl;
}
} else {
cerr  Could not initialize MySQL:   mysql_error(conn)  endl;
}
}
/** mysqltest.cpp 
*/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: C API : Problem using multi-statements

2005-05-06 Thread Javier Diaz
 
Hi

Instead of use two INSERT statements, try something like this:

INSERT INTO Table table1 VALUES (list of values1), (list of values2) 



-Original Message-
From: Jeremiah Gowdy [mailto:[EMAIL PROTECTED] 
Sent: 06 May 2005 17:19
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: C API : Problem using multi-statements

Answer is simple.  Can't do that.

- Original Message - 
From: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Friday, May 06, 2005 5:40 AM
Subject: C API : Problem using multi-statements


Hello,

I have some problems using multiple queries in a databased driven project, 
therefore I wrote a little testprogram which
causes the same problems.

I am using the C-API of MySQL 4.1.11 on a Gentoo Linux 3.3.2-r5, 
propolice-3.3-7 with 2.4.27 kernel.
I connect to the server (on localhost) with mysql_real_connect and the flag 
CLIENT_MULTI_STATEMENTS,
I submit multiple queries (two INSERTS seperated by ;) on the existing 
connection.
Executing the multistatement with mysql_query in a loop (i.e. 10 times),
I get a lot of lost connection during query errors, but sending a single 
INSERT query in a loop causes no errors !!!

Thanks in advance for help
regards Tinosch Ganjineh


The following program operates on a simple table structure created with the 
following statement :
CREATE TABLE BIGTABLE (myoid char(40), mykey char(40), myval char(40), myint

bigint) TYPE = InnoDB;

/** mysqltest.cpp 
*/
#include iostream
#include mysql.h
#include sstream
#include string

using namespace std;

string itos(long long i) {
ostringstream sstream;
sstream  i;
return sstream.str();
}

int main(int argc, char** argv) {
MYSQL* conn;
if(conn = mysql_init(NULL)) {
if(mysql_real_connect(conn, localhost, root, x, test, 0, NULL, 
CLIENT_MULTI_STATEMENTS )) {
int loop=100;
for(int i=0; iloop; ++i) {
int e=0;
string query;
query = string(INSERT INTO BIGTABLE VALUES () + 'object- +itos(i)+', 
'foo', 'bar', NULL);\
INSERT INTO BIGTABLE VALUES ( + 'object- +itos(i+1000)+', 'bar, 'foo', 
NULL);
e = mysql_query(conn, query.c_str());
if(e) {
cerr  *Query failed*:   e   -   mysql_error(conn) 

endl;
} else {
MYSQL_RES* result = mysql_store_result(conn);
if(result) {
// .. parse result set ...
} else {
//cerr  Could not fetch Results from DB:   mysql_error(conn);
}
mysql_free_result(result);
}
}
} else {
cerr  Could not connect to MySQL database:   mysql_error(conn)  
endl;
}
} else {
cerr  Could not initialize MySQL:   mysql_error(conn)  endl;
}
}
/** mysqltest.cpp 
*/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: C API : Problem using multi-statements

2005-05-06 Thread Jeremiah Gowdy
doh!  need another redbull.  :)
- Original Message - 
From: Reggie Burnett [EMAIL PROTECTED]
To: 'Jeremiah Gowdy' [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
mysql@lists.mysql.com
Sent: Friday, May 06, 2005 9:31 AM
Subject: RE: C API : Problem using multi-statements


Jeremiah
I don't use the client library in my work but this should work from 4.1 
on.

-Reggie
-Original Message-
From: Jeremiah Gowdy [mailto:[EMAIL PROTECTED]
Sent: Friday, May 06, 2005 11:19 AM
To: [EMAIL PROTECTED]; mysql@lists.mysql.com
Subject: Re: C API : Problem using multi-statements
Answer is simple.  Can't do that.
- Original Message -
From: [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Friday, May 06, 2005 5:40 AM
Subject: C API : Problem using multi-statements
Hello,
I have some problems using multiple queries in a databased driven project,
therefore I wrote a little testprogram which
causes the same problems.
I am using the C-API of MySQL 4.1.11 on a Gentoo Linux 3.3.2-r5,
propolice-3.3-7 with 2.4.27 kernel.
I connect to the server (on localhost) with mysql_real_connect and the 
flag
CLIENT_MULTI_STATEMENTS,
I submit multiple queries (two INSERTS seperated by ;) on the existing
connection.
Executing the multistatement with mysql_query in a loop (i.e. 10 times),
I get a lot of lost connection during query errors, but sending a single
INSERT query in a loop causes no errors !!!

Thanks in advance for help
regards Tinosch Ganjineh
The following program operates on a simple table structure created with 
the
following statement :
CREATE TABLE BIGTABLE (myoid char(40), mykey char(40), myval char(40), 
myint

bigint) TYPE = InnoDB;
/** mysqltest.cpp
*/
#include iostream
#include mysql.h
#include sstream
#include string
using namespace std;
string itos(long long i) {
ostringstream sstream;
sstream  i;
return sstream.str();
}
int main(int argc, char** argv) {
MYSQL* conn;
if(conn = mysql_init(NULL)) {
if(mysql_real_connect(conn, localhost, root, x, test, 0, NULL,
CLIENT_MULTI_STATEMENTS )) {
int loop=100;
for(int i=0; iloop; ++i) {
int e=0;
string query;
query = string(INSERT INTO BIGTABLE VALUES () + 'object- +itos(i)+',
'foo', 'bar', NULL);\
INSERT INTO BIGTABLE VALUES ( + 'object- +itos(i+1000)+', 'bar, 'foo',
NULL);
e = mysql_query(conn, query.c_str());
if(e) {
cerr  *Query failed*:   e   -   mysql_error(conn) 


endl;
} else {
MYSQL_RES* result = mysql_store_result(conn);
if(result) {
// .. parse result set ...
} else {
//cerr  Could not fetch Results from DB:   mysql_error(conn);
}
mysql_free_result(result);
}
}
} else {
cerr  Could not connect to MySQL database:   mysql_error(conn) 
endl;
}
} else {
cerr  Could not initialize MySQL:   mysql_error(conn)  endl;
}
}
/** mysqltest.cpp
*/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


A MySQL C++ API problem about Connection::close() Connection::purge()!

2002-04-30 Thread ???

In MySQL C++ API
http://www.mysql.com/Downloads/mysql++/mysql++-1.7.1-win32-borland.zip ,
http://www.mysql.com/Downloads/mysql++/mysql++-1.7.1-1-win32-vc++.zip.
The head file connection1.hh has two problems.
1. Function Connection::close()
void close(void) { mysql_close(mysql); }
2. Function Connection::purge()
void purge (void) { mysql_close(mysql); },

Maybe change to
Connection::close()
void close(void) {is_connected = false; mysql_close(mysql);}

Connection::purge()
void purge (void) {is_connected = false; mysql_close(mysql);}

= end of description



sql,
qurey


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




FW: A MySQL C++ API problem about Connection::close() Connection::purge().

2002-04-30 Thread ???

In MySQL C++ API
http://www.mysql.com/Downloads/mysql++/mysql++-1.7.1-win32-borland.zip ,
http://www.mysql.com/Downloads/mysql++/mysql++-1.7.1-1-win32-vc++.zip.
The head file connection1.hh has two problems.
1. Function Connection::close()
void close(void) { mysql_close(mysql); }
2. Function Connection::purge()
void purge (void) { mysql_close(mysql); },

Maybe change to
Connection::close()
void close(void) {is_connected = false; mysql_close(mysql);}

Connection::purge()
void purge (void) {is_connected = false; mysql_close(mysql);}

= end of description



sql,
qurey


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem, CREATE TABLE SELECT SELECT

2001-11-23 Thread Kristian Vlahovicek

Hello, 

I seem to have a problem with the C API, briefly I try to select something
into a temporary table and then do three selects, two of which are from the
temporary table created. Program segfaults.
When I comment all but temp table creation, program works, and same happens
for a non-temp table select, but when both are present, the program simply
refuses to run.

code details (complete queries ommitted for clarity, queries are not problematic
- they were tested with the standalone mysql client):


query_len = sprintf(query, CREATE TEMPORARY TABLE temp SELECT );
fprintf(stderr, QUERY: %s\nLEN: %d\n, query, query_len);

if (mysql_real_query(db_read, query, query_len)) {
free(query);
b_abort(CREATE TABLE temp unsuccessful: %s, mysql_error(db_read));
}

if (mysql_affected_rows(db_read) == 0) { /* no rows transferred to the temp table, 
skip entry */
fprintf(stderr, CREATE TABLE selected no rows, skipping id %d\n, id);
free(query);
return 1; /* no self score found, but the query was OK */
}
fprintf(stderr, Created table with results for id %d, affected rows %lu, errcode 
%d\n, id, (unsigned long) mysql_affected_rows(db_read), mysql_errno(db_read));

/* get group and self-score */
query_len = sprintf(query, SELECT a1, a2 FROM t1,t2 GROUP BY ...);
fprintf(stderr, QUERY: %s\nLEN: %d\n, query, query_len);

if (mysql_query(db_read, query)) {
b_abort(SELECT from BRP, Map unsuccessful: %s, mysql_error(db_read));
}
res_set = mysql_store_result(db_read);
fprintf(stderr, SELECT FROM ResultPairs, affected rows %lu, result_set %lu rows\n, 
(unsigned long) mysql_affected_rows(db_read), (unsigned long) mysql_num_rows(res_set));

if (res_set  mysql_num_rows(res_set)){
if ((row = mysql_fetch_row(res_set)) != NULL){
mygrp = (unsigned long) atol(row[0]);
selfscore = (unsigned long) atol(row[1]);
}
mysql_free_result(res_set);
} else {
fprintf(stderr, SELF SCORE selected no rows, skipping id %d, id);
free(query);
return 1; /* no self sacore found, but the query was OK */
}
fprintf(stderr, selected group (%d)  selfscore (%d) results for id %d\n, mygrp, 
selfscore, id);

when both queries are uncommented the program segfaults in:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1024 (LWP 11049)]
chunk_alloc (ar_ptr=0x401d0a00, nb=49) at malloc.c:2929
2929malloc.c: No such file or directory.
in malloc.c
(gdb) where
#0  chunk_alloc (ar_ptr=0x401d0a00, nb=49) at malloc.c:2929
#1  0x4011c108 in __libc_malloc (bytes=40) at malloc.c:2811
#2  0x4003c12d in my_malloc () from /usr/lib/mysql/libmysqlclient.so.10
#3  0x40037e4c in read_rows () from /usr/lib/mysql/libmysqlclient.so.10
#4  0x40039554 in mysql_read_query_result () from
/usr/lib/mysql/libmysqlclient.so.10
#5  0x400395ff in mysql_real_query () from
/usr/lib/mysql/libmysqlclient.so.10
#6  0x400393bb in mysql_query () from /usr/lib/mysql/libmysqlclient.so.10
#7  0x0804b285 in do_statistics (db_read=0x805c800, db_write=0x805fbf8,
id=102, type=3) at Stattest.c:291
#8  0x0804b82a in main (argc=6, argv=0xbb24) at Stattest.c:552
#9  0x400b8627 in __libc_start_main (main=0x804b3ec main, argc=6,
ubp_av=0xbb24, init=0x8049a6c _init, 
fini=0x8056d00 _fini, rtld_fini=0x4000dcd4 _dl_fini,
stack_end=0xbb1c)
at ../sysdeps/generic/libc-start.c:129



when I comment either ow the two, the program runs OK. Any ideas?
Kristian


--
Dr. sc. Kristian Vlahovicek 
Protein structure  bioinformatics  Phone:  +39 0403757354
ICGEB   Fax:+39 040226555
Padriciano 99   E-mail: kristian(at)icgeb(dot)trieste(dot)it
Trieste 34012 Italy Web: http://www.icgeb.trieste.it/dna


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem, CREATE TABLE SELECT SELECT

2001-11-23 Thread Attila Soki

| query_len = sprintf(query, CREATE TEMPORARY TABLE temp SELECT );

try it out with asprintf(). 
but you have to define at compile time the following -D_GNU_SOURCE

maybe you allocates not enough place for query. asprintf do it for you.

char *query;
int query_len;

query_len=asprintf(query,select...);
mysql_real_query(db_read, query, query_len);
free(query);
if (..){
...

cheers,

ati

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Mysql C API Problem

2001-09-01 Thread BeachTHO

am connecting to a mysql server on localhost i put all the code in a function call 
mysql_conlocal
MYSQL csql;
int mysql_conlocal() { 
puts(Connecting to Mysql Server);
if(!mysql_connect(csql,DBHOST,DBUSER,DBPASS)) { 
puts(Failure!);
puts(This Could Because);
puts(A Your Username or Password is incorrect);
puts(B Your Server is not running or is down);
puts(C Your login name does not have access to connect from this machine );
exit(1);
}else if (mysql_select_db(csql,DB) !=0) { 
puts(Connecting to DBFailure!);
puts(This is probably because the DB Doesnt exist or you username doenst have access 
to it);
exit(1);
}
puts(Connecting to DB... Success!);
}

but it generates a segmentation fault  

but if i take i out of my own application and run it as a seperate app it runs fine
i am also using another socket in my application to connect to another server medium 
it is called sockfd 
could this cause problems


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Mysql C API Problem

2001-09-01 Thread Uwe Sander

just add

mysql_init(csql);

before accessing the struct for any purpose.


Sure it helps (I made the same mistake, got the same result ;-)

Uwe


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 01, 2001 8:25 PM
Subject: Mysql C API Problem


 am connecting to a mysql server on localhost i put all the code in a
function call mysql_conlocal
 MYSQL csql;
 int mysql_conlocal() {
 puts(Connecting to Mysql Server);
 if(!mysql_connect(csql,DBHOST,DBUSER,DBPASS)) {
 puts(Failure!);
 puts(This Could Because);
 puts(A Your Username or Password is incorrect);
 puts(B Your Server is not running or is down);
 puts(C Your login name does not have access to connect from this machine
);
 exit(1);
 }else if (mysql_select_db(csql,DB) !=0) {
 puts(Connecting to DBFailure!);
 puts(This is probably because the DB Doesnt exist or you username doenst
have access to it);
 exit(1);
 }
 puts(Connecting to DB... Success!);
 }

 but it generates a segmentation fault

 but if i take i out of my own application and run it as a seperate app it
runs fine
 i am also using another socket in my application to connect to another
server medium
 it is called sockfd
 could this cause problems


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-04-26 Thread john1

Dear Sir :

MySQL 3.22.32 on my linux 486 PC seems work so good. When I compile 
a simple C API program which catched from MySQL tutorial, it
chokes at the end of compile process . The program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;

int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o my_code my_code.c -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

Then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

Nothing left to do with the situation, I beg your help. Anyway I'm a 
newcomer. Thank you very much.

Please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-04-19 Thread john1

Dear Sir :

MySQL 3.22.32 on my linux 486 PC seems work so good. When I compile 
a simple C API program which catched from MySQL tutorial, it
chokes at the end of compile process . The program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;

int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o my_code my_code.c -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

Then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

Nothing left to do with the situation, I beg your help. Anyway I'm a 
newcomer. Thank you very much.

Please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-04-19 Thread Laurent Oget

On Thu, Apr 19, 2001 at 11:12:23PM +0800, john1 wrote:
 
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x14):undefined reference to 'open64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
 mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x21):undefined reference to 'fopen64'
 


looks like you have a version of libc that is too old

 

-- 
Laurent Oget, Ph.D. [EMAIL PROTECTED]http://oget.net
Senior Engineer Zvolve Systems Inc  http://zvolve.com
Chercheur Associ   Liafa   http://liafa.jussieu.fr

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-19 Thread Gerald L. Clark

You clibs are too old. You are probably running a very old
version of Linux.

john1 wrote:
 
 Dear Sir :
 
 MySQL 3.22.32 on my linux 486 PC seems work so good. When I compile
 a simple C API program which catched from MySQL tutorial, it
 chokes at the end of compile process . The program is as follows:
 
 #include stdio.h
 #include mysql.h
 
 #define def_host_name NULL
 #define def_user_name NULL
 #define def_password  NULL
 #define def_db_name NULL
 
 MYSQL *conn;
 int main(int argc,char *argv[])
 {
 conn=mysql_init(NULL);
 mysql_real_connect(
  conn,
  def_host_name,
  def_user_name,
  def_password,
  def_db_name,
  0, /*port defaut*/
  NULL,  /*socket default*/
  0);/*flag*/
 mysql_close(conn);
 exit(0);
 }
 
 I compile as follows:
 
 gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
-L/home/MySQL/MySQL/lib \
 -lmysqlclient
 
 Then I get :
 
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x14):undefined reference to 'open64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
 mf_format.o(.text+0x201):undefined reference to '__lxstat64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x21):undefined reference to 'fopen64'
 
 Nothing left to do with the situation, I beg your help. Anyway I'm a
 newcomer. Thank you very much.
 
 Please send message to [EMAIL PROTECTED]
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-18 Thread john1

Dear Sir :

MySQL 3.22.32 on my linux 486 PC seems work so good. When I compile 
a simple C API program which catched from MySQL tutorial, it
chokes at the end of compile process . The program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

Then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

Nothing left to do with the situation, I beg your help. Anyway I'm a 
newcomer. Thank you very much.

Please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-18 Thread john1

Dear Sir :

MySQL 3.22.32 on my linux 486 PC seems work so good. When I compile 
a simple C API program which catched from MySQL tutorial, it
chokes at the end of compile process . The program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

Then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

Nothing left to do with the situation, I beg your help. Anyway I'm a 
newcomer. Thank you very much.

Please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-07 Thread john1

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API program which catched from the MySQL tutorial, it
chokes at the end of compile process . the program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-07 Thread Gerald L. Clark

Your clibs are too old.
You need to update.

john1 wrote:
 
 dear Sir :
 
 MySQL 3.22 on my linux 486 PC seems work so good. when I compile
 a simple C API program which catched from the MySQL tutorial, it
 chokes at the end of compile process . the program is as follows:
 
 #include stdio.h
 #include mysql.h
 
 #define def_host_name NULL
 #define def_user_name NULL
 #define def_password  NULL
 #define def_db_name NULL
 
 MYSQL *conn;
 int main(int argc,char *argv[])
 {
 conn=mysql_init(NULL);
 mysql_real_connect(
  conn,
  def_host_name,
  def_user_name,
  def_password,
  def_db_name,
  0, /*port defaut*/
  NULL,  /*socket default*/
  0);/*flag*/
 mysql_close(conn);
 exit(0);
 }
 
 I compile as follows:
 
 gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
-L/home/MySQL/MySQL/lib \
 -lmysqlclient
 
 then I get :
 
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x14):undefined reference to 'open64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
 mf_format.o(.text+0x201):undefined reference to '__lxstat64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x21):undefined reference to 'fopen64'
 
 nothing left to do with the situation, I beg your help. anyway I'm a
 newcomer. thank you very much.
 
 please send message to [EMAIL PROTECTED]
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-05 Thread john1

dear Sir,

It's so exiting receive your mail. For months it's the first and perhaps
the only mail I receive. Thank you.
There are quetions remain: 

Isn't it the complete 3.22 package I installed ? I've read several
text books about Mysql, that they don't mention the Mysql-devel
package, and the authors encourage compile and link directly.
What do you think ? But at the end I would follow your way.
Where is the Mysql-devel package I can get(download) ?
In Mysql and tcx website I can't find the package.

please send message to [EMAIL PROTECTED]

Solute.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-05 Thread john1

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API program which catched from the MySQL tutorial, it
chokes at the end of compile process . the program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-05 Thread john1

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API program which catched from the MySQL tutorial, it
chokes at the end of compile process . the program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-05 Thread Boulat Khakimov

john1 wrote:
 
 dear Sir :
 
 MySQL 3.22 on my linux 486 PC seems work so good. when I compile
 a simple C API program which catched from the MySQL tutorial, it
 chokes at the end of compile process . the program is as follows:
 
 #include stdio.h
 #include mysql.h
 
 #define def_host_name NULL
 #define def_user_name NULL
 #define def_password  NULL
 #define def_db_name NULL
 
 MYSQL *conn;
 int main(int argc,char *argv[])
 {
 conn=mysql_init(NULL);
 mysql_real_connect(
  conn,
  def_host_name,
  def_user_name,
  def_password,
  def_db_name,
  0, /*port defaut*/
  NULL,  /*socket default*/
  0);/*flag*/
 mysql_close(conn);
 exit(0);
 }
 
 I compile as follows:
 
 gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
-L/home/MySQL/MySQL/lib \
 -lmysqlclient
 
 then I get :
 
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x14):undefined reference to 'open64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
 mf_format.o(.text+0x201):undefined reference to '__lxstat64'
 /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
 my_open.o(.text+0x21):undefined reference to 'fopen64'
 
 nothing left to do with the situation, I beg your help. anyway I'm a
 newcomer. thank you very much.
 
 please send message to [EMAIL PROTECTED]
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


You missing -lz in the list of gcc options.

Regards,
Boulat

-- 
Nothing Like the Sun

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: C API problem

2001-03-05 Thread Quentin Bennett

Hi,

Check for open64 in the archives for the last month, and you will find your
answer (which is to upgrade your gcc).

Regards

Quentin

-Original Message-
From: john1 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 6 March 2001 4:47 a.m.
To: [EMAIL PROTECTED]
Subject: C API problem


dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API program which catched from the MySQL tutorial, it
chokes at the end of compile process . the program is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64'

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

The information contained in this email is privileged and confidential
and intended for the addressee only. If you are not the intended 
recipient, you are asked to respect that confidentiality and not 
disclose, copy or make use of its contents. If received in error 
you are asked to destroy this email and contact the sender immediately. 
Your assistance is appreciated.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-01 Thread john1

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API programe which catched from the MySQL tutorial, it
chokes at the end of compile process . the programe is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




C API problem

2001-03-01 Thread john1

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API programe which catched from the MySQL tutorial, it
chokes at the end of compile process . the programe is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-01 Thread Sinisa Milivojevic

Laurent Oget writes:
  I am not sure this will solve your probleme but you need to add -lnsl and -lsocket 
 to the compile command line.
  
  On Thu, Mar 01, 2001 at 11:03:11PM +0800, john1 wrote:
   dear Sir :
   
   MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
   a simple C API programe which catched from the MySQL tutorial, it
   chokes at the end of compile process . the programe is as follows:
   
   #include stdio.h
   #include mysql.h
   
   #define def_host_name NULL
   #define def_user_name NULL
   #define def_password  NULL
   #define def_db_name NULL

   MYSQL *conn;
   int main(int argc,char *argv[])
   {
   conn=mysql_init(NULL);
   mysql_real_connect(
conn,
def_host_name,
def_user_name,
def_password,
def_db_name,
0,/*port defaut*/
NULL, /*socket default*/
0);   /*flag*/
   mysql_close(conn);
   exit(0);
   }
   
   I compile as follows:
   
   gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
  -L/home/MySQL/MySQL/lib \
   -lmysqlclient
   
   then I get :
   
   /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
   my_open.o(.text+0x14):undefined reference to 'open64'
   /home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
   mf_format.o(.text+0x201):undefined reference to '__lxstat64'   
   
   /home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
   my_open.o(.text+0x21):undefined reference to 'fopen64'
   
   nothing left to do with the situation, I beg your help. anyway I'm a 
   newcomer. thank you very much.
   
   please send message to [EMAIL PROTECTED]   
   
   
 
   
   -
   Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
   
   To request this thread, e-mail [EMAIL PROTECTED]
   To unsubscribe, e-mail [EMAIL PROTECTED]
   Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
   
  
  -- 
  Laurent Oget, Ph.D.  [EMAIL PROTECTED]
  Senior Engineer  Zvolve Systems Inc  http://zvolve.com
  Chercheur AssociLiafa   http://liafa.jussieu.fr
  


No, the above means he has to update his glibc.


Regards,

Sinisa

    __ _   _  ___ ==  MySQL AB
 /*/\*\/\*\   /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic
/*/ /*/ /*/   \*\_   |*|   |*||*| mailto:[EMAIL PROTECTED]
   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*| Larnaca, Cyprus
  /*/ /*/  /*/\*\_/*/ \*\_/*/ |*|
  /*/^^^\*\^^^
 /*/ \*\Developers Team

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: C API problem

2001-03-01 Thread Shambhu Kumar singh

Hi John,

I had faced a similar problem earlier, I solved it my instaling MySQL-devel package 
and include the libmyclient library stored in /usr/lib (not in /usr/lib/mysql/)in the 
compile command.

Best of Luck,
Shambhu.

- Original Message --
john1 [EMAIL PROTECTED] wrote:
To:[EMAIL PROTECTED]
From:john1 [EMAIL PROTECTED]
Date:Thu, 1 Mar 2001 23:03:11 +0800
Subject:C API problem

dear Sir :

MySQL 3.22 on my linux 486 PC seems work so good. when I compile 
a simple C API programe which catched from the MySQL tutorial, it
chokes at the end of compile process . the programe is as follows:

#include stdio.h
#include mysql.h

#define def_host_name NULL
#define def_user_name NULL
#define def_password  NULL
#define def_db_name NULL
 
MYSQL *conn;
int main(int argc,char *argv[])
{
conn=mysql_init(NULL);
mysql_real_connect(
 conn,
 def_host_name,
 def_user_name,
 def_password,
 def_db_name,
 0, /*port defaut*/
 NULL,  /*socket default*/
 0);/*flag*/
mysql_close(conn);
exit(0);
}

I compile as follows:

gcc -o client my_simplest_prog -I/home/MySQL/MySQL/include \
   -L/home/MySQL/MySQL/lib \
-lmysqlclient

then I get :

/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x14):undefined reference to 'open64'
/home/MySQL/MySQL/lib/libmysqlclient.a(mf_format.o)In function 'fn_format':
mf_format.o(.text+0x201):undefined reference to '__lxstat64' 
/home/MySQL/MySQL/lib/libmysqlclient.a(my_open.o)In function 'my_open':
my_open.o(.text+0x21):undefined reference to 'fopen64'

nothing left to do with the situation, I beg your help. anyway I'm a 
newcomer. thank you very much.

please send message to [EMAIL PROTECTED]   
   
   
  

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail 
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


_
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




MySQL C API: Problem with load_defaults

2001-01-20 Thread Hlady, Brian


I'm using the code found on page 245 - 247 of Paul Dubois' book, MySQL. When
I attempt to make it
under Code Crusader, I get the error found below.

gcc  -g -Wall -Werror -I- -I. -I/usr/local/include/mysql  -c common.c -o
common.o
gcc  -g -Wall -Werror -I- -I. -I/usr/local/include/mysql  -c client4.c -o
client4.o
cc1: warnings being treated as errors
client4.c: In function `main':
client4.c:35: warning: passing arg 2 of `load_defaults' from incompatible
pointer type
make: *** [show_argv.o] Error 1

This occurs in the groups argument to load_defaults. Groups is declared as
char *groups[] = {"client", null};

load_defaults is called in the following manner:

snip
my_init();
load_defaults ("my", groups, argc, argv);
snip

When I remove the -Werror, it makes fine, and the program runs correctly.
Has anybody else encountered
this problem?

Software versions:
glibc version is 2.1.3-15
mysql version is 3.23.27-beta, installed from source with 
  ./configure --enable-thread-safe-client --with-pthread --with-debug
Running Redhat 6.2 (Zoot)

Thanx
-Brian K. Hlady

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL C API: Problem with load_defaults

2001-01-20 Thread Paul DuBois

On Sat, Jan 20, 2001 at 02:53:22PM -0500, Hlady, Brian wrote:
 I'm using the code found on page 245 - 247 of Paul Dubois' book, MySQL. When
 I attempt to make it
 under Code Crusader, I get the error found below.
 
 gcc  -g -Wall -Werror -I- -I. -I/usr/local/include/mysql  -c common.c -o
 common.o
 gcc  -g -Wall -Werror -I- -I. -I/usr/local/include/mysql  -c client4.c -o
 client4.o
 cc1: warnings being treated as errors
 client4.c: In function `main':
 client4.c:35: warning: passing arg 2 of `load_defaults' from incompatible
 pointer type
 make: *** [show_argv.o] Error 1
 
 This occurs in the groups argument to load_defaults. Groups is declared as
 char *groups[] = {"client", null};

Try putting "const" in front of "char" and see what happens.


 load_defaults is called in the following manner:
 
 snip
 my_init();
 load_defaults ("my", groups, argc, argv);
 snip
 
 When I remove the -Werror, it makes fine, and the program runs correctly.
 Has anybody else encountered
 this problem?
 
 Software versions:
 glibc version is 2.1.3-15
 mysql version is 3.23.27-beta, installed from source with 
   ./configure --enable-thread-safe-client --with-pthread --with-debug
 Running Redhat 6.2 (Zoot)
 
 Thanx
 -Brian K. Hlady

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php