Browse Source

Remove semicolon in query.

Remove semicolon at the end of an rr:sqlQuery as some relational
databases cannot cope with that character in a subquery.
Christophe Debruyne 8 years ago
parent
commit
c097ce0cf7
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/r2rml/model/LogicalTable.java

+ 7 - 0
src/r2rml/model/LogicalTable.java

@@ -95,6 +95,13 @@ public class LogicalTable extends R2RMLResource {
 			
 			// All clear
 			sqlQuery = n.toString().trim();
+			
+			// Some relational databases do not support semicolons at the end
+			// of a subquery, so remove one when it appears. Technically, one
+			// can have many such semicolons (with white spaces), but we start
+			// by removing one.
+			if(sqlQuery.endsWith(";")) 
+				sqlQuery = sqlQuery.substring(0, sqlQuery.length() - 1);
 		}
 
 		return true;