Thanks for your reply. I do not have any problem in compilation. My problems are with double quote characters, single quote characters and insufficient help. Is there any way I can supress exceptions?
Here is one of the problems I am facing when try to run a sample. The sample compiles with 0 errors. When I run the sample it gives error message "Error: You have an error in your SQL syntax near '%q0, %q1, 1.25, 1.1, %q4)' at line 1." Then I removed 'q's. Still it is giving run time error. Also there is no help on execute(). Thanks, Radha ---------------------------------------------------------------------------- ----------------------- #include <iostream> #include <sqlplus.hh> int main (int argc, char *argv[]) { Connection connection(use_exceptions); try { // the entire main block is one big try block; if (argc == 1) connection.connect(""); else if (argc == 2) connection.connect("",argv[1]); else if (argc == 3) connection.connect("",argv[1],argv[2]); else if (argc <= 4) connection.connect("",argv[1],argv[2],argv[3]); // create a new object and connect based on any (if any) arguments // passed to main(); try { connection.select_db("mysql_cpp_data"); } catch (BadQuery er) { // if it couldn't connect to the database assume that it doesn't exist // and try created it. If that does not work exit with an error. connection.create_db("mysql_cpp_data"); connection.select_db("mysql_cpp_data"); } Query query = connection.query(); // create a new query object try { // ignore any errors here // we hope to make this simpler soon query.execute("drop table stock"); } catch (BadQuery er) {} query << "create table stock (item char(20) not null, num smallint," << "weight double, price double, sdate date)"; query.execute(RESET_QUERY); // send the query to create the table and execute it. The // RESET_QUERY tells the query object to reset it self after // execution query << "insert into %5:table values (%q0, %q1, %2, %3, %q4)"; query.parse(); // set up the template query we will use to insert the data. The // parse method call is important as it is what lets the query // know that this is a template and not a literal string query.def["table"] = "stock"; // This is setting the parameter named table to stock. query.execute ("Hamburger Buns", 56, 1.25, 1.1, "1998-04-26"); query.execute ("Hotdogs' Buns" ,65, 1.1 , 1.1, "1998-04-23"); query.execute ("Dinner Roles" , 75, .95, .97, "1998-05-25"); query.execute ("White Bread" , 87, 1.5, 1.75, "1998-09-04"); // The last parameter "table" is not specified here. Thus // the default value for "table" is used which is "stock". } catch (BadQuery er) { // handle any errors that may come up cerr << "Error: " << er.error << endl; return -1; } } ---------------------------------------------------------------------------- ----- Original Message ----- From: "Sinisa Milivojevic" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, March 12, 2002 5:15 AM Subject: Re: MySQL++ samples are not working? > Radhakrishna Mohan Tadepalli writes: > > Does anybody tried MySQL++ samples? I guess they are not working. Any help > > is appreciated -Radha > > > > Hi! > > They should all be working. > > Supported compilers : > > * GNU 2.95.* and 3.* > * Compaq 6.3 > * VC++ 6.0 (custom*.cc examples do not work) > * BC++ 5.* > > -- > Regards, > __ ___ ___ ____ __ > / |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic <[EMAIL PROTECTED]> > / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer > /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus > <___/ www.mysql.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 _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.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