MCPcopy Create free account
hub / github.com/cmu-db/benchbase / setSQL

Method setSQL

src/main/java/com/oltpbenchmark/api/SQLStmt.java:61–76  ·  view source on GitHub ↗

Magic SQL setter! Each occurrence of the pattern "??" will be replaced by a string of repeated ?'s @param sql

(String sql)

Source from the content-addressed store, hash-verified

59 * @param sql
60 */
61 public final void setSQL(String sql) {
62 this.orig_sql = sql.trim();
63 for (int ctr : this.substitutions) {
64 StringBuilder sb = new StringBuilder();
65 for (int i = 0; i < ctr; i++) {
66 sb.append(i > 0 ? ", " : "").append("?");
67 }
68 Matcher m = SUBSTITUTION_PATTERN.matcher(sql);
69 String replace = sb.toString();
70 sql = m.replaceFirst(replace);
71 }
72 this.sql = sql;
73 if (LOG.isDebugEnabled()) {
74 LOG.debug("Initialized SQL:\n{}", this.sql);
75 }
76 }
77
78 public final String getSQL() {
79 return (this.sql);

Callers 4

testSetSQLMethod · 0.95
loadSQLDialectMethod · 0.95
SQLStmtMethod · 0.95

Calls 2

appendMethod · 0.80
toStringMethod · 0.45

Tested by 1

testSetSQLMethod · 0.76