Re: mysql c-api 1064 mysql_real_query: issue with upgrade to 4.1.3

2004-08-28 Thread Aftab Jahan Subedar
Can you check the client version and server version from c api?
you can copy  paste it from (ehem)
http://www.geocities.com/jahan.geo/mysql_c_by_example.html
VY wrote:
Hi,
 For some reason, all my sql queries fail with a 1064;
These were all working under mysql-4.0 but had to
upgrade to 4.1 so i could use nested subqueries
i have attached a simple 10 line c-code as proof of
concept.  Obviously there is nothing wrong with the
query...
#include stdio.h
#include stdlib.h
#include unistd.h
#include string.h
#include mysql.h
 
static MYSQL handle;
 
int main() {
  char query[1500];
  int c;
 
 
  mysql_init(handle);
  if (!mysql_real_connect(handle, localhost,
mysql, mysql, honey_db, 0, NULL, 0)) {
 fprintf(stderr, connect failed %s\n,
mysql_error(handle));
 exit(1);
  }
 
  sprintf(query, select * from test);
  printf(%s\n, query);
 
  c = mysql_real_query(handle, query,
strlen(query)+500);
  if (c)
  {
 printf(query failed...%d %d\n, c,
mysql_errno(handle));
 printf(mysql_error(handle));
  }
}
 

The output is as follows (the first two lines are my
debug output)

select * from test  
query failed...1 1064
You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version
for the right syntax to use near '' at line 1:
I have tried both FreeBSD 
mysql-standard-4.1.3-beta-unknown-freebsd4.7-i386
and the linux-4.1.3 rpm with identical results.

Please let me know what im doing wrong  The table
test exists in honey_db and is accessible by the
mysql user.
Thanks!

		
__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

--
Aftab Jahan Subedar
CEO/Software Engineer
Subedar Technologies
Subedar Baag
Bibir Bagicha #1
North Jatrabari
Dhaka 1204
Bangladesh
http://www.SubedarTechnologies.com
http://www.DhakaStockExchangeGame.com/
http://www.CEOBangladesh.com/
http://www.NYSEGame.com
tel://+88027519050
EMail://[EMAIL PROTECTED] - Directly to my notebook
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


mysql c-api 1064 mysql_real_query: issue with upgrade to 4.1.3

2004-08-27 Thread VY
Hi,

 For some reason, all my sql queries fail with a 1064;
These were all working under mysql-4.0 but had to
upgrade to 4.1 so i could use nested subqueries

i have attached a simple 10 line c-code as proof of
concept.  Obviously there is nothing wrong with the
query...


#include stdio.h
#include stdlib.h
#include unistd.h
#include string.h
#include mysql.h
 
static MYSQL handle;
 
int main() {
  char query[1500];
  int c;
 
 
  mysql_init(handle);
  if (!mysql_real_connect(handle, localhost,
mysql, mysql, honey_db, 0, NULL, 0)) {
 fprintf(stderr, connect failed %s\n,
mysql_error(handle));
 exit(1);
  }
 
  sprintf(query, select * from test);
  printf(%s\n, query);
 
  c = mysql_real_query(handle, query,
strlen(query)+500);
  if (c)
  {
 printf(query failed...%d %d\n, c,
mysql_errno(handle));
 printf(mysql_error(handle));
  }
}
 


The output is as follows (the first two lines are my
debug output)

 select * from test  
 query failed...1 1064
 You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version
for the right syntax to use near '' at line 1:


I have tried both FreeBSD 
mysql-standard-4.1.3-beta-unknown-freebsd4.7-i386
and the linux-4.1.3 rpm with identical results.

Please let me know what im doing wrong  The table
test exists in honey_db and is accessible by the
mysql user.


Thanks!




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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