MYSQL

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Strange error when to use MySQL++ 2.2.0 inplace of MySQL++ 2.1.1

    3 answers - 2482 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Dear All,
    This is my first email in this forum. I am writing a network application
    that uses MySQL as the data repository using win32 C++ using Visual C++ 2005
    express edition on windows xp in addition to MySQL2.1.1.
    However, I tried to use the latest version of MySQL2.2.0 that it just
    recently issued instead of the prior one MySQL-2.1.1. Unfortunately, I am
    getting runtime error when the execution calls out the store() function in
    order to retrieve the result set to Result vector object.
    I am catching that run time error and the message that I am getting is:
    Query error: 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 4
    My code snippet is:
    #include <mysqlh>
    #include <result.h>
    using namespace mysqlpp;
    void (Query *radiusQuery)
    {
    Result configResult;
    try
    {
    *radiusQuery << "SELECT c.profile_name, c.authentication_port,
    c.accounting_port, c.any_nas, s.secret_name, c.considration_id,
    r.considration_comment, c.log_verbosity, c.format_id, l.format_name,
    l.format_plugin\nFRM configurations_table AS c INNER JIN
    (shared_secrets_table AS s, realm_considration_table AS r,
    logging_format_table AS l)\N (c.secret_id = s.secret_id AND
    c.considration_id = r.considration_id AND c.format_id = l.format_id)\nWHERE
    c.active_profile = true;";
    cout << radiusQuery->preview() << endl << endl;
    configResult = radiusQuery->store();
    }
    catch (const mysqlpp::BadQuery& er) {
    // Handle any query errors
    cerr << "Query error: " << er.what() << endl;
    }
    catch (const mysqlpp::BadConversion& er) {
    // Handle bad conversions; e.g. type mismatch populating 'stock'
    cerr << "Conversion error: " << er.what() << endl <<
    "\tretrieved data size: " << er.retrieved <<
    ", actual size: " << er.actual_size << endl;
    }
    catch (const mysqlpp::Exception& er) {
    // Catch-all for any other MySQL++ exceptions
    cerr << "Error: " << er.what() << endl;
    }
    }
    Can anyone tell me why I am getting this unexpected error?
    Your help is much appreciated
    Regards
    Bassam
  • No.1 | | 1577 bytes | |

    Thanks for your response. I wonder if it is considered a bug in the release
    2.2.0. When my application runs at a Debug mode, it needs to show up the
    query on the consol.

    According to the documentation, the preview() has to be called up before
    executing the query. So what can I do in this case. Shall I continue with
    the previous release 2.1.1 or not. Is the latest release stable or not?

    Your help is much appreciated.

    Regards
    Bassam

    Message
    From: [mailto:breeze (AT) begun (DOT) ru]
    Sent: Thursday, February 08, 2007 3:09 PM
    To: bassam (AT) palettemm (DOT) com
    Subject: Re: Strange error when to use MySQL++ 2.2.0 inplace of MySQL++
    2.1.1

    Problem is in preview() call - it cause query
    corruption. You should not call preview() _before_ execute query.

    try

    {

    *radiusQuery << "SELECT c.profile_name, c.authentication_port,
    c.accounting_port, c.any_nas, s.secret_name, c.considration_id,
    r.considration_comment, c.log_verbosity, c.format_id, l.format_name,
    l.format_plugin\nFRM configurations_table AS c INNER JIN
    (shared_secrets_table AS s, realm_considration_table AS r,
    logging_format_table AS l)\N (c.secret_id = s.secret_id AND
    c.considration_id = r.considration_id AND c.format_id =
    l.format_id)\nWHERE
    c.active_profile = true;";
    >
    >
    >

    cout << radiusQuery->preview() << endl << endl;
    >
    >
    >

    configResult = radiusQuery->store();

    }
  • No.2 | | 400 bytes | |

    Bassam A. Al-Khaffaf wrote:
    I wonder if it is considered a bug in the release 2.2.0.

    Yes.

    Shall I continue with the previous release 2.1.1 or not.

    That's up to you.

    Is the latest release stable or not?

    Yes, but that doesn't mean it's bug-free. I can't fix it right now, but
    it will be among the first things I do fix when I get some time.
  • No.3 | | 576 bytes | |

    08/02/07, Bassam A. Al-Khaffaf <bassam (AT) palettemm (DOT) comwrote:

    Query error: 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 4

    IIRC you do not want ';' in the SQL string. That is used on the
    command line or in scripts to indicate the end of a query, but when
    you pass a query to the API it knows when the end of the SQL statement
    is (the end of the string)

    Just remove the last character of yiour SQL.

    jon

Re: Strange error when to use MySQL++ 2.2.0 inplace of MySQL++ 2.1.1


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "MYSQL"

EMSDN.COM