6 messages in com.mysql.lists.plusplusRe: Newbie question
FromSent OnAttachments
Gustavo Castro08 Oct 2003 02:31 
Markus Gerwinski08 Oct 2003 04:07 
Gustavo Castro08 Oct 2003 05:58 
Markus Gerwinski08 Oct 2003 06:39 
Gustavo Castro08 Oct 2003 07:21 
Markus Gerwinski08 Oct 2003 10:40 
Subject:Re: Newbie question
From:Gustavo Castro (g_ca@ya.com)
Date:10/08/2003 05:58:27 AM
List:com.mysql.lists.plusplus

ok, this is my source code test.cc (i didn´t include the headers and that stuff, but it´s is the same as in simple1.cc, in the example folder):

int main() { try{ char *data_buff; Connection con(use_exceptions); con.connect("Sistemas"); Query query = con.query(); query<<"SELECT GETUPDATE("<<data_buff<<")"; query.execute();

FILE *fic; fic = fopen("data_update.log","a"); fprintf(fic,"%s",data_buff); fclose(fic);

} catch (BadQuery er) { // handle any connection or // query errors that may come up cerr << "Error: " << er.error << endl; return -1; } } GETUPDATE is a function i added which gets a pointer and it fills it with information of the keys which are modified when doing a delete, update or insert. So this api would call GETUPDATE, who would add information about the keys, and then would print that information in the file "data_update.log". First of all, in /usr/local/mysql/bin i type ./safe_mysqld --user=mysql & and then in the same place ./mysql -p, so everything is running. Then i go to the examples folder of the mysql++ and type test(), and it is then, after pressing enter, that i get this prompt ">", and it doesn´t matter what i type (i´ve tried with numbers, sql commands, etc) that i get the syntax error.

Gustavo Castro wrote:

Hello, i`m quite new using this (or any) api, so this must be a pretty easy question: i?ve done this program, test.cc, which is very simple, i?ve compiled it but when i run it i get this prompt " > ", and whatever i type in there i get this message "bash: syntax error near unexpected token &&&", where &&& is whatever i typed. I?ve tried before and after launching the mysql, but i get always that mistake, even if i try with one of the files of the "examples" folder.

Could you post the source of your test.cc and the exact command you used to compile it? Could you give some examples of the commands you typed after the prompt? What exactly do you mean by "launching the mysql"? Which commands did you use, and what was their sequence?