· 9 years ago · Dec 08, 2016, 11:41 AM
1package JDBC;
2
3import java.sql.SQLException;
4
5public interface IDbms {
6
7 // return data from sql command suppose that it's correct sqlsyntax and if
8 // there is no result return empty array
9 // constructor of Resultmetdata
10 // private ArrayList<ArrayList<Object>> table; >>> objects not strings
11 // private ArrayList<String> colNames;
12 // private ArrayList<Integer> colTypes; >>> integers of (java.sql.types)
13 // private String tableName;
14 //
15 //
16 // public ResultSetMetaData(ArrayList<ArrayList<Object>> table,
17 // ArrayList<String> colNames, ArrayList<Integer> colTypes,
18 // String tableName) {
19 // int length = colNames.size();
20 // this.colNames = new ArrayList<>(colNames);
21 // this.colTypes = new ArrayList<>(colTypes);
22 // this.colTypes = colTypes;
23 // this.tableName = tableName;
24 // }
25 public ResultSetMetaData excuteSelectSql(String sql)throws SQLException;
26
27 // return select,update,insert,delete,drop,create,use,....
28 public String getFirstIdentifier(String sql)throws SQLException;
29
30 // return number of rows affected from sql command
31 // suppose that it's correct sqlsyntax
32 // DDl use create alter drop >>> 0 insert delete update >> count
33 public int excuteUpdateSql(String sql)throws SQLException;
34
35 // this random to create some randomness in the name of the database/directory, so that each test is done separately from other tests
36 //For example, for "/tmp/jdbc/123456", with two databases "A", and "B", the hierarchy should be:
37 //
38 // | /tmp/jdbc/123456/
39 // |---- A/
40 // |---- B/
41 //
42 // Where "A" and "B" are the directories of each database, respectively.
43 // this directory is a folder of databases ,
44 // because of multi threading
45 // you should make sure that path exists and there's directory in this path
46 // if there's directory i think you should overwrite it :D
47 // if there's no directory in this path create it and make it your current directory
48 // any command is done on dbms object for this thread is done on this directory
49 public String makeDir(String path,String directory,String random);
50
51}