major changes in imports and exports
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / Source.java
index ea316253d7cf5d0ae5f2dc3a736a0054221f86b4..e1e71a997cc662c7655fa75240164f8a32afd20e 100644 (file)
@@ -155,6 +155,29 @@ public class Source {
         }\r
     }\r
 \r
+    //******* INSERT, UPDATE, DELETE *******************//\r
+    /**\r
+     * Executes an insert, update or delete statement.\r
+     * Returns the number of rows changed or -1 if updatedStatement was 0 or and error occurred. \r
+     * Does not change the Sources query-string!!\r
+     * @return Resultset for the query.\r
+     */\r
+    public int update (String updateStatement){\r
+       int result;\r
+       try {\r
+            this.getConnection(); //establish connection\r
+               if (updateStatement == null){\r
+                       return -1;\r
+               }\r
+            mStmt = mConn.createStatement();\r
+            result = mStmt.executeUpdate(updateStatement);\r
+            return result;\r
+        }catch(SQLException e){\r
+            logger.error("Problems when creating Resultset for query \n  " + updateStatement + " \n" + "Exception: " + e);\r
+            return -1;\r
+        }\r
+    }\r
+\r
     \r
     /** \r
      * Returns the Resultset for Sources query. \r