在SQL查询中使用information_schema.tables字符串同步问题

时间:2011-05-29 19:25:14

标签: java mysql rest

我正在用Java语言编写REST Web服务 它运行在Tomcat 6上并与MySQL DB进行通信。 MySQL自带的XAMPP应用程序是我去年夏天安装的,不能告诉你版本。因此,程序检查是否存在关系。但由于某些原因,MySQL认为最近丢弃的关系存在,而不是。 这是执行该检查的代码片段。

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;
  }
}

我在这个论坛上听说使用information_schema存在同步问题。 sql查询中的表字符串。进行相同检查的替代解决方案是什么?

0 个答案:

没有答案