mirror of
https://github.com/boostorg/mysql.git
synced 2026-02-14 00:42:53 +00:00
Added connection::prepare_statement sync exc
This commit is contained in:
@@ -18,11 +18,12 @@ struct PrepareStatementTest : public IntegTestAfterHandshake
|
||||
{
|
||||
};
|
||||
|
||||
// sync errc
|
||||
TEST_F(PrepareStatementTest, SyncErrc_OkNoParams)
|
||||
{
|
||||
auto stmt = conn.prepare_statement("SELECT * FROM empty_table", errc, info);
|
||||
validate_no_error();
|
||||
EXPECT_TRUE(stmt.valid());
|
||||
ASSERT_TRUE(stmt.valid());
|
||||
EXPECT_GT(stmt.id(), 0);
|
||||
EXPECT_EQ(stmt.num_params(), 0);
|
||||
}
|
||||
@@ -43,12 +44,23 @@ TEST_F(PrepareStatementTest, SyncErrc_Error)
|
||||
EXPECT_FALSE(stmt.valid());
|
||||
}
|
||||
|
||||
// sync exc
|
||||
TEST_F(PrepareStatementTest, SyncExc_Ok)
|
||||
{
|
||||
auto stmt = conn.prepare_statement("SELECT * FROM empty_table WHERE id = ?");
|
||||
ASSERT_TRUE(stmt.valid());
|
||||
EXPECT_GT(stmt.id(), 0);
|
||||
EXPECT_EQ(stmt.num_params(), 1);
|
||||
}
|
||||
|
||||
TEST_F(PrepareStatementTest, SyncExc_Err)
|
||||
{
|
||||
validate_sync_fail([this] {
|
||||
conn.prepare_statement("SELECT * FROM bad_table WHERE id IN (?, ?)");
|
||||
}, Error::no_such_table, {"table", "doesn't exist", "bad_table"});
|
||||
}
|
||||
|
||||
|
||||
// prepared_statement::execute
|
||||
// OK, no params
|
||||
// OK, with params
|
||||
// OK, select, insert, update, delete
|
||||
// Error, wrong number of parameters
|
||||
// resultset::fetch_xxxx: repeat the same tests as in query
|
||||
// Cover no params, with params, select, insert, update, delete, with table/fields as params
|
||||
// statements life cycle
|
||||
|
||||
Reference in New Issue
Block a user