localizing sql faults in
play

Localizing SQL Faults in Database Applications Gregory M. Kapfhammer - PowerPoint PPT Presentation

Localizing SQL Faults in Database Applications Gregory M. Kapfhammer Sarah R. Clark * , Jake Cobb * , James A. Jones , and Mary Jean Harrold * * Georgia Institute of Technology Allegheny College University of California, Irvine


  1. Localizing SQL Faults in Database Applications Gregory M. Kapfhammer † Sarah R. Clark * , Jake Cobb * , James A. Jones ‡ , and Mary Jean Harrold * * Georgia Institute of Technology † Allegheny College ‡ University of California, Irvine Supported by NSF CCF-1116943 and Google Faculty Research Award to UC Irvine, NSF CCF-0725202, CCF-0541048, IBM Software Quality Innovation Award, and InComm to Georgia Tech, and by SIGSOFT CAPS

  2. Real-World Software Applications Application Code

  3. Real-World Software Applications Application Code Relational Database

  4. Real-World Software Applications Relational Database Configuration File Application Code

  5. Real-World Software Applications Relational Database Configuration File Application Code Remote Server

  6. Real-World Software Applications Relational Database Configuration File Application Code Key Observations • The database is an essential component of real-world software • Brooks and colleagues report that the most common errors in three real-world industrial systems involve Remote Server database interactions (ICST 2009)

  7. Real-World Software Applications Relational Database Configuration File Application Code Important Questions • How well do existing fault-localization techniques perform for commonly implemented database applications? • Does the use of additional information about the database improve the Remote Server effectiveness of these methods?

  8. Motivating Example printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); }

  9. Motivating Example printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); }

  10. Motivating Example printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); }

  11. Motivating Example printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); } MID CID PROD PRICE 1 1 Soda $0.99 1 3 Cheese 3.99 2 2 Hammer 5.00 2 3 Nails 0.50 Database Table

  12. Motivating Example printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); } uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50 Database Table Configuration File

  13. Motivating Example printProdsold(String uType, String uID){ Error in the 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); whereClause! 3:String SQL=“SELECT ”+attr+ >= ”FROM Sale Where ”+whereClause; should be 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); = 6:printResultSet(rs); } uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50 Database Table Configuration File

  14. Statistical Fault Localization printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID); 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ ”FROM Sale Where ”+whereClause; 4:PreparedStatement ps=new PreparedStatement(); 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); } uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50 Database Table Configuration File

  15. Statistical Fault Localization Techniques use: printProdsold(String uType, String uID){ Dynamic information 1:String attr=conf.getAttr(uType,uID); • statements executed 2:String whereClause=conf.getWhere(uType,uID); 3:String SQL=“SELECT ”+attr+ • outcome (pass/fail) ”FROM Sale Where ”+whereClause; Statistical analysis 4:PreparedStatement ps=new PreparedStatement(); • computes suspiciousness 5:ResultSet rs=ps.executeQuery(SQL); 6:printResultSet(rs); of each statement } uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50 Database Table Configuration File

  16. Statistical Fault Localization M, 1 M, 2 C, 1 C, 2 C, 3 printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID);      2:String whereClause=conf.getWhere(uType,uID);      3:String SQL=“SELECT ”+attr+      ”FROM Sale Where ”+whereClause;      4:PreparedStatement ps=new PreparedStatement();      5:ResultSet rs=ps.executeQuery(SQL);      6:printResultSet(rs);      } F P P P P Pass/Fail Status uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50

  17. Statistical Fault Localization M, 1 M, 2 C, 1 C, 2 C, 3 printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID);      2:String whereClause=conf.getWhere(uType,uID);      3:String SQL=“SELECT ”+attr+      ”FROM Sale Where ”+whereClause;      4:PreparedStatement ps=new PreparedStatement();      5:ResultSet rs=ps.executeQuery(SQL);      6:printResultSet(rs);      } F P P P P Pass/Fail Status uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50

  18. Statistical Fault Localization M, 1 M, 2 C, 1 C, 2 C, 3 printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID);      2:String whereClause=conf.getWhere(uType,uID);      3:String SQL=“SELECT ”+attr+      ”FROM Sale Where ”+whereClause;      4:PreparedStatement ps=new PreparedStatement();      5:ResultSet rs=ps.executeQuery(SQL);      6:printResultSet(rs);      } F P P P P Pass/Fail Status uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50

  19. Statistical Fault Localization M, 1 M, 2 C, 1 C, 2 C, 3 printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID);      2:String whereClause=conf.getWhere(uType,uID);      3:String SQL=“SELECT ”+attr+      ”FROM Sale Where ”+whereClause;      4:PreparedStatement ps=new PreparedStatement();      5:ResultSet rs=ps.executeQuery(SQL);      6:printResultSet(rs);      } F P P P P Pass/Fail Status uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50

  20. Statistical Fault Localization M, 1 M, 2 C, 1 C, 2 C, 3 printProdsold(String uType, String uID){ 1:String attr=conf.getAttr(uType,uID);      2:String whereClause=conf.getWhere(uType,uID);      3:String SQL=“SELECT ”+attr+      ”FROM Sale Where ”+whereClause;      4:PreparedStatement ps=new PreparedStatement();      5:ResultSet rs=ps.executeQuery(SQL);      6:printResultSet(rs);      } F P P P P Pass/Fail Status uType Merchant (M) MID CID PROD PRICE attr PRODUCT, PRICE 1 1 Soda $0.99 whereClause MID>=uID 1 3 Cheese 3.99 uType Customer (C) attr PRODUCT, PRICE 2 2 Hammer 5.00 whereClause CID=uID 2 3 Nails 0.50

Recommend


More recommend