當(dāng)前位置:
首頁 >
MySQL建表语句解析表名
發(fā)布時(shí)間:2023/12/10
47
豆豆
生活随笔
收集整理的這篇文章主要介紹了
MySQL建表语句解析表名
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
/*** input: sqlCreateTableScript放置建表語句* output: nameList表名列表*/String sqlCreateTableScript="";String[] scriptArray=sqlCreateTableScript.split("(?i)"+"CREATE"+"\\s+"+"TABLE");//大小寫都匹配List<String> nameList=new ArrayList<>(Arrays.asList(scriptArray));for(int i=0;i<nameList.size();i++) {String e=nameList.get(i);if(e==null||e.equals("")||e.indexOf("(")<0) {nameList.remove(i);i--;}else {e=e.substring(0,e.indexOf("("));e=e.replaceAll(" ", "");e=e.replaceAll("`", "");nameList.set(i, e);System.out.println(e);} }System.out.println("一共有"+nameList.size()+"個(gè)表名");
總結(jié)
以上是生活随笔為你收集整理的MySQL建表语句解析表名的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 超导量子计算机速度多快,我国量子计算机实
- 下一篇: mysql 开发 生产_在没有表锁定的情