Code Monkey home page Code Monkey logo

Comments (1)

TommyLemon avatar TommyLemon commented on June 8, 2024

加引号是主要为了保证不和 SQL 关键词冲突,以及避免可能的 SQL 注入风险(目前应该没有这个风险,所有表名、字段名及它们的别名全都用正则判断是否为对应的 Java 变量名格式)。

} else if (!.equalsIgnoreCase(rsmd.getTableName(i))) {

可以改为

String sqlTable = config.getSQLTable();
if (config.isClickHouse()) {
  sqlTable = "‘" + sqlTable + "‘";
}
...

} else if ( ! sqlTable .equalsIgnoreCase(rsmd.getTableName(i))) {

不过这种方式需要确定 JDBC 对 ClickHouse 返回的表名一定是以 ‘ 这个引号包裹的(可能在 不同版本 JDBC 或 不同版本 ClickHouse 或 ClickHouse 不同配置下 表现也不一致)

from apijsondemo_clickhouse.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.