Hi,
I have problems creating prepared statement. It came back with this
error message:
SQL error: ERROR: prepared statement "InsertMSISDN" does not exist.
Below is my code.
Thanks,
Khoa
// ===============================================
int main(int, char *argv[])
{
string QName = "InsertMSISDN";
string query = "INSERT INTO subs VALUES ($1, $2)";
try
{
// Set up connection to database
string ConnectString = (argv[1] ? argv[1] : "");
connection C(ConnectString);
C.prepare(QName, query)
("varchar", pqxx::prepare::treat_string)
("integer", pqxx::prepare::treat_direct);
work t(C, "MyWork");
t.prepared(QName)("22222")(100).exec();
// C.disconnect();
}
catch (const sql_error &e)
{
// If we're interested in the text of a failed query, we can write separate
// exception handling code for this type of exception
cerr << "SQL error: " << e.what() << endl
<< "Query was: '" << e.query() << "'" << endl;
return 1;
}
catch (const exception &e)
{
// All exceptions thrown by libpqxx are derived from std::exception
cerr << "Exception: " << e.what() << endl;
return 2;
}
catch (...)
{
// This is really unexpected (see above)
cerr << "Unhandled exception" << endl;
return 100;
}
return 0;
}
// ===============================================
_______________________________________________
Libpqxx-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general