GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(DQE): Add Extensibility to DQE (#1272) · sqlancer/sqlancer@8eb5af4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/sqlancer
    • common/oracle
      • DQEBase.java
    • mysql/oracle
      • MySQLDQEOracle.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/sqlancer/common/oracle/DQEBase.java‎

Copy file name to clipboardExpand all lines: src/sqlancer/common/oracle/DQEBase.java
+7-11Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sqlancer.common.query.SQLQueryAdapter;
1414
import sqlancer.common.query.SQLQueryError;
1515
import sqlancer.common.schema.AbstractRelationalTable;
16-
import sqlancer.mysql.MySQLSchema.MySQLTables;
16+
import sqlancer.common.schema.AbstractTables;
1717

1818
/*
1919
* In DBMSs, SELECT, UPDATE and DELETE queries utilize predicates (i.e., WHERE clauses) to specify which rows to retrieve, update or delete, respectively.
@@ -54,19 +54,15 @@ public DQEBase(S state) {
5454
this.options = state.getOptions();
5555
}
5656

57-
public abstract String generateSelectStatement(MySQLTables tables, String tableName, String whereClauseStr);
57+
public abstract String generateSelectStatement(AbstractTables<?, ?> tables, String tableName,
58+
String whereClauseStr);
5859

59-
public abstract String generateUpdateStatement(MySQLTables tables, String tableName, String whereClauseStr);
60+
public abstract String generateUpdateStatement(AbstractTables<?, ?> tables, String tableName,
61+
String whereClauseStr);
6062

61-
public abstract String generateDeleteStatement(MySQLTables tables, String tableName, String whereClauseStr);
63+
public abstract String generateDeleteStatement(String tableName, String whereClauseStr);
6264

63-
/**
64-
* Add auxiliary columns to the database A abstract method, subclasses need to implement it.
65-
*
66-
* @param table
67-
*
68-
* @throws SQLException
69-
*/
65+
// Add auxiliary columns to the database A abstract method, subclasses need to implement it.
7066
public abstract void addAuxiliaryColumns(AbstractRelationalTable<?, ?, ?> table) throws SQLException;
7167

7268
public void dropAuxiliaryColumns(AbstractRelationalTable<?, ?, ?> table) throws SQLException {
Collapse file

‎src/sqlancer/mysql/oracle/MySQLDQEOracle.java‎

Copy file name to clipboardExpand all lines: src/sqlancer/mysql/oracle/MySQLDQEOracle.java
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import sqlancer.common.query.SQLancerResultSet;
2323
import sqlancer.common.schema.AbstractRelationalTable;
2424
import sqlancer.common.schema.AbstractTable;
25+
import sqlancer.common.schema.AbstractTables;
2526
import sqlancer.mysql.MySQLErrors;
2627
import sqlancer.mysql.MySQLGlobalState;
2728
import sqlancer.mysql.MySQLSchema;
@@ -57,16 +58,17 @@ public MySQLDQEOracle(MySQLGlobalState state) {
5758
}
5859

5960
@Override
60-
public String generateSelectStatement(MySQLTables tables, String tableName, String whereClauseStr) {
61+
public String generateSelectStatement(AbstractTables<?, ?> tables, String tableName, String whereClauseStr) {
6162
operateOnSingleTable = tables.getTables().size() == 1;
6263
List<String> selectColumns = new ArrayList<>();
63-
for (MySQLTable table : tables.getTables()) {
64+
MySQLTables mySQLTables = (MySQLTables) tables;
65+
for (MySQLTable table : mySQLTables.getTables()) {
6466
selectColumns.add(table.getName() + "." + COLUMN_ROWID);
6567
}
6668
if (operateOnSingleTable && Randomly.getBooleanWithSmallProbability()) {
6769
generateOrderBy = true;
6870
// generate order by columns
69-
for (MySQLColumn column : Randomly.nonEmptySubset(tables.getColumns())) {
71+
for (MySQLColumn column : Randomly.nonEmptySubset(mySQLTables.getColumns())) {
7072
orderColumns.add(column.getFullQualifiedName());
7173
}
7274

@@ -88,9 +90,10 @@ public String generateSelectStatement(MySQLTables tables, String tableName, Stri
8890
}
8991

9092
@Override
91-
public String generateUpdateStatement(MySQLTables tables, String tableName, String whereClauseStr) {
93+
public String generateUpdateStatement(AbstractTables<?, ?> tables, String tableName, String whereClauseStr) {
9294
List<String> updateColumns = new ArrayList<>();
93-
for (MySQLTable table : tables.getTables()) {
95+
MySQLTables mySQLTables = (MySQLTables) tables;
96+
for (MySQLTable table : mySQLTables.getTables()) {
9497
updateColumns.add(String.format("%s = 1", table.getName() + "." + COLUMN_UPDATED));
9598
}
9699
String updateStmt = String.format("UPDATE %s SET %s WHERE %s", tableName, Strings.join(",", updateColumns),
@@ -105,7 +108,7 @@ public String generateUpdateStatement(MySQLTables tables, String tableName, Stri
105108
}
106109

107110
@Override
108-
public String generateDeleteStatement(MySQLTables tables, String tableName, String whereClauseStr) {
111+
public String generateDeleteStatement(String tableName, String whereClauseStr) {
109112
String deleteStmt;
110113
if (operateOnSingleTable) {
111114
deleteStmt = String.format("DELETE FROM %s WHERE %s", tableName, whereClauseStr);
@@ -141,7 +144,7 @@ public void check() throws SQLException {
141144

142145
String updateStmt = generateUpdateStatement(tables, tableName, whereClauseStr);
143146

144-
String deleteStmt = generateDeleteStatement(tables, tableName, whereClauseStr);
147+
String deleteStmt = generateDeleteStatement(tableName, whereClauseStr);
145148

146149
for (MySQLTable table : tables.getTables()) {
147150
addAuxiliaryColumns(table);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.