Sync issue using information_schema.tables string in SQL query
I am writing a REST Web service in Java language.
It runs on Tomcat 6 and talks to MySQL DB. MySQL comes with XAMPP app what I installed last year in summer, can't tell you the version. So, the program checks if relation exists. But for some reasons MySQL thinks that the relation which was dropped lately exists when it does not. This is the snippet of code which does that checking.private Boolean tableExists(String globalId) {
// schema Test
DBResult result = db.selectQuery("SELECT table_name
FROM information_schema.tables
WHERE table_schema = '"+schema+"'
AND table_name = " + "\'" + "category_"+globalId.split("-")[1]+ "\'"+";");
if(result.getRowCount() > 0) {
logger.info(" Table exist "+globalId);
return true;
} else {
logger.info("table does not exist "+ globalId);
return false;
}
}
I heard on this forum that there exists sync problems using information_schema. tables string in the sql query. What is the alternative solution to do the same ch开发者_StackOverflowecking?
精彩评论