Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Exit clean up when use "sql::Connection" after network disabled. (1 reply)

$
0
0
Hello ^^

I'm new on using mysql_cpp_conn with c++ and having a problem.


below is my testing code,
-----------------------------------------------

sql::Connection * _con;
sql::Statement * _stmt;

...


try {
if (false == _con->isValid()){ // ----------- A
return false;
}
_pstmt = _con->prepareStatement(string); // ------------ B
}catch (sql::SQLException &e) {
manageException(e); // ------------ C
return false;
}
-----------------------------------------------
this works well in normal situation. but in my testing scenarios this code
exit clean up. no throwing exceptions.


[ my scenario ]

1. procses start~

2. breaking points at code [A, b, C]

3. run code [A] -> it's ok

3. disable ethernet adaptor! it's simulation for ethernet-adaptor's hardware faults.

4. run code B -> exit clean up. process terminated. no exceptions.

* in case unpluged rj45 cable, it's throw SQLException. but in case disabled ethernet adaptor, it's just exit process.


it's ok function's failed but i want to keep running my process not exit.

THX

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>