Skip to content

Commit

Permalink
error more
Browse files Browse the repository at this point in the history
  • Loading branch information
HydroxideX committed Dec 7, 2019
1 parent 91cc67e commit cf320c6
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 111 deletions.
1 change: 0 additions & 1 deletion dist/Databases/x/yahia.xml → dist/Databases/a/y.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<table>
<name DataType="varchar">yahia</name>
<age DataType="int">-15</age>
</table>
8 changes: 0 additions & 8 deletions dist/Databases/x/yahia.xsd → dist/Databases/a/y.xsd
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="nameType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="DataType" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="ageType">
<xs:simpleContent>
<xs:extension base="xs:string">
Expand All @@ -16,7 +9,6 @@
</xs:complexType>
<xs:complexType name="tableType">
<xs:sequence>
<xs:element name="name" type="nameType"/>
<xs:element name="age" type="ageType"/>
</xs:sequence>
</xs:complexType>
Expand Down
Binary file modified dist/JDBC-API.jar
Binary file not shown.
Binary file renamed dist/JDBCLibrary.jar → dist/Library/JDBC-API.jar
Binary file not shown.
121 changes: 27 additions & 94 deletions dist/Log.txt
Original file line number Diff line number Diff line change
@@ -1,94 +1,27 @@
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ SEVERE ] 12\07\2019 , 15:20 : Use Query failed!
[ FINE ] 12\07\2019 , 15:20 : Connection Closed
[ FINE ] 12\07\2019 , 15:20 : Statement Closed
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ FINE ] 12\07\2019 , 15:20 : Connection Closed
[ FINE ] 12\07\2019 , 15:20 : Statement Closed
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ FINE ] 12\07\2019 , 15:20 : Connection Closed
[ FINE ] 12\07\2019 , 15:20 : Statement Closed
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ FINE ] 12\07\2019 , 15:20 : Connection Closed
[ FINE ] 12\07\2019 , 15:20 : Statement Closed
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ FINE ] 12\07\2019 , 15:20 : Select Query executed
[ FINE ] 12\07\2019 , 15:20 : Connection Closed
[ FINE ] 12\07\2019 , 15:20 : Statement Closed
[ FINER ] 12\07\2019 , 15:20 : Connection Initiated
[ FINER ] 12\07\2019 , 15:20 : Statement Created
[ FINE ] 12\07\2019 , 15:21 : Select Query executed
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ FINE ] 12\07\2019 , 15:21 : Select Query executed
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ SEVERE ] 12\07\2019 , 15:21 : Select Query failed
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ FINE ] 12\07\2019 , 15:21 : Select Query executed
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ SEVERE ] 12\07\2019 , 15:21 : Select Query failed
[ FINE ] 12\07\2019 , 15:21 : Connection Closed
[ FINE ] 12\07\2019 , 15:21 : Statement Closed
[ FINER ] 12\07\2019 , 15:21 : Connection Initiated
[ FINER ] 12\07\2019 , 15:21 : Statement Created
[ FINER ] 12\07\2019 , 15:26 : Connection Initiated
[ FINER ] 12\07\2019 , 15:26 : Statement Created
[ FINE ] 12\07\2019 , 15:26 : Use Query executed
[ FINE ] 12\07\2019 , 15:26 : Connection Closed
[ FINE ] 12\07\2019 , 15:26 : Statement Closed
[ FINER ] 12\07\2019 , 15:26 : Connection Initiated
[ FINER ] 12\07\2019 , 15:26 : Statement Created
[ FINE ] 12\07\2019 , 15:26 : Select Query executed
[ FINE ] 12\07\2019 , 15:26 : Connection Closed
[ FINE ] 12\07\2019 , 15:26 : Statement Closed
[ FINER ] 12\07\2019 , 15:26 : Connection Initiated
[ FINER ] 12\07\2019 , 15:26 : Statement Created
[ FINE ] 12\07\2019 , 15:26 : Update Query executed
[ FINE ] 12\07\2019 , 15:26 : Connection Closed
[ FINE ] 12\07\2019 , 15:26 : Statement Closed
[ FINER ] 12\07\2019 , 15:26 : Connection Initiated
[ FINER ] 12\07\2019 , 15:26 : Statement Created
[ FINE ] 12\07\2019 , 15:27 : Select Query executed
[ FINE ] 12\07\2019 , 15:27 : Connection Closed
[ FINE ] 12\07\2019 , 15:27 : Statement Closed
[ FINER ] 12\07\2019 , 15:27 : Connection Initiated
[ FINER ] 12\07\2019 , 15:27 : Statement Created
[ SEVERE ] 12\07\2019 , 15:27 : Select Query failed
[ FINE ] 12\07\2019 , 15:27 : Connection Closed
[ FINE ] 12\07\2019 , 15:27 : Statement Closed
[ FINER ] 12\07\2019 , 15:27 : Connection Initiated
[ FINER ] 12\07\2019 , 15:27 : Statement Created
[ SEVERE ] 12\07\2019 , 15:27 : Select Query failed
[ FINE ] 12\07\2019 , 15:27 : Connection Closed
[ FINE ] 12\07\2019 , 15:27 : Statement Closed
[ FINER ] 12\07\2019 , 15:27 : Connection Initiated
[ FINER ] 12\07\2019 , 15:27 : Statement Created
[ SEVERE ] 12\07\2019 , 15:27 : Select Query failed
[ FINE ] 12\07\2019 , 15:27 : Connection Closed
[ FINE ] 12\07\2019 , 15:27 : Statement Closed
[ FINER ] 12\07\2019 , 15:27 : Connection Initiated
[ FINER ] 12\07\2019 , 15:27 : Statement Created
[ FINER ] 12\07\2019 , 15:59 : Connection Initiated
[ FINER ] 12\07\2019 , 15:59 : Statement Created
[ FINE ] 12\07\2019 , 15:59 : Connection Closed
[ FINE ] 12\07\2019 , 15:59 : Statement Closed
[ FINER ] 12\07\2019 , 15:59 : Connection Initiated
[ FINER ] 12\07\2019 , 15:59 : Statement Created
[ FINE ] 12\07\2019 , 15:59 : Connection Closed
[ FINE ] 12\07\2019 , 15:59 : Statement Closed
[ FINER ] 12\07\2019 , 15:59 : Connection Initiated
[ FINER ] 12\07\2019 , 15:59 : Statement Created
[ FINE ] 12\07\2019 , 15:59 : Update Query executed
[ FINE ] 12\07\2019 , 15:59 : Connection Closed
[ FINE ] 12\07\2019 , 15:59 : Statement Closed
[ FINER ] 12\07\2019 , 15:59 : Connection Initiated
[ FINER ] 12\07\2019 , 15:59 : Statement Created
[ FINE ] 12\07\2019 , 16:00 : Select Query executed
[ FINE ] 12\07\2019 , 16:00 : Connection Closed
[ FINE ] 12\07\2019 , 16:00 : Statement Closed
[ FINER ] 12\07\2019 , 16:00 : Connection Initiated
[ FINER ] 12\07\2019 , 16:00 : Statement Created
[ FINE ] 12\07\2019 , 16:00 : Select Query executed
[ FINE ] 12\07\2019 , 16:00 : Connection Closed
[ FINE ] 12\07\2019 , 16:00 : Statement Closed
[ FINER ] 12\07\2019 , 16:00 : Connection Initiated
[ FINER ] 12\07\2019 , 16:00 : Statement Created
[ FINER ] 12\07\2019 , 16:13 : Connection Initiated
[ FINER ] 12\07\2019 , 16:13 : Statement Created
2 changes: 1 addition & 1 deletion src/eg/edu/alexu/csd/oop/cs71/db/FileManagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Arrays;
import java.util.HashMap;

public class FileManagement implements FileManagementInterface{
public class FileManagement extends FileManagementInterface{
public void writeInFile(String tableName, HashMap<String, String> tableColumns, ArrayList<HashMap<String, Object>> tableData, String currentDatabase,ArrayList <String> cNames, ArrayList<String> cTypes){
String[] columnContents =new String[tableColumns.size()];
Arrays.fill(columnContents, "");
Expand Down
41 changes: 37 additions & 4 deletions src/eg/edu/alexu/csd/oop/cs71/db/FileManagementInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,41 @@
import java.util.ArrayList;
import java.util.HashMap;

public interface FileManagementInterface {
void writeInFile(String tableName, HashMap<String, String> tableColumns, ArrayList<HashMap<String, Object>> tableData, String currentDatabase,ArrayList <String> cNames, ArrayList<String> cTypes);
void readFile(String tableName, HashMap<String, String> tableColumns, ArrayList<HashMap<String, Object>> tableData, String currentDatabase, ArrayList<String> cNames, ArrayList<String> cTypes) throws IOException, ParserConfigurationException, SAXException;
String getTableName(String query);
public abstract class FileManagementInterface {
abstract void writeInFile(String tableName, HashMap<String, String> tableColumns, ArrayList<HashMap<String, Object>> tableData, String currentDatabase,ArrayList <String> cNames, ArrayList<String> cTypes);
abstract void readFile(String tableName, HashMap<String, String> tableColumns, ArrayList<HashMap<String, Object>> tableData, String currentDatabase, ArrayList<String> cNames, ArrayList<String> cTypes) throws IOException, ParserConfigurationException, SAXException;
String getTableName(String query){
String tableName="";
String[] parts=query.split(" ");
parts[0]=parts[0].toLowerCase();
switch (parts[0])
{
case "select":{
int index=0;
for (String x:parts) {
x=x.toLowerCase();
if(x.equals("from")){
index++;
break;
}
index++;
}
tableName=parts[index];
}
break;
case "insert":
case "alter":
case "delete":{
tableName=parts[2];
parts=tableName.split("\\(" );
tableName=parts[0];
}
break;
case "update":{
tableName=parts[1];
}
break;
}
return tableName;
}
}
6 changes: 3 additions & 3 deletions src/eg/edu/alexu/csd/oop/cs71/db/SQLParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,12 @@ public int alter(String query, ArrayList<String> cNames, ArrayList<String> cType
}

private void operationParser(String query, ArrayList<String> colNames, ArrayList<String> colTypes, ArrayList<HashMap<String, Object>> table) {
query = query.replaceAll("\\s+|\\(+|\\)|\\,|(?i)(and\\s+(?='|\\d))|\\;", " ");
query = query.replaceAll("\\s+|\\(+|\\)|\\,|(?i)(and\\s+(?='|-?\\d))|\\;", " ");
query = query.replaceAll("\\s*\\<\\>\\s*", " != ");
query = query.replaceAll("\\s+(?=\\=)", "");
Pattern P1 = Pattern.compile("\\A[\\s]*(\\w+)[\\s]*(<|>|>\\s*=|<\\s*=|!\\s*=|=)[\\s]*([']?\\w+[']?)[\\s]*\\z");
Pattern P1 = Pattern.compile("\\A[\\s]*(\\w+)[\\s]*(<|>|>\\s*=|<\\s*=|!\\s*=|=)[\\s]*([']?-?\\w+[']?)[\\s]*\\z");
Matcher M1;
Pattern P2 = Pattern.compile("\\A[\\s]*(\\w+)[\\s]*((?i)between|in)([\\s]*([']?\\w+[']?)[\\s]*)+\\z");
Pattern P2 = Pattern.compile("\\A[\\s]*(\\w+)[\\s]*((?i)between|in)([\\s]*([']?-?\\w+[']?)[\\s]*)+\\z");
Matcher M2;
logicOperatorParser(query, colNames, colTypes, table);
query = query.replaceAll("(?i)(not)\\s*", "");
Expand Down

0 comments on commit cf320c6

Please sign in to comment.