import com.marcozanon.macaco.sql.MSqlConnection;
import com.marcozanon.macaco.sql.MSqlConnectionFailureException;
import com.marcozanon.macaco.sql.MSqlConnectionGenerator;
+import com.marcozanon.macaco.sql.MSqlStatementException;
import com.marcozanon.macaco.sql.MSqlTable;
-import com.marcozanon.macaco.sql.MStatementSqlException;
import com.marcozanon.macaco.text.MText;
import java.text.SimpleDateFormat;
import java.util.Date;
catch (MSqlConnectionFailureException exception) {
throw new MLoggingException("Could not write to database table.", exception);
}
- catch (MStatementSqlException exception) {
+ catch (MSqlStatementException exception) {
throw new MLoggingException("Could not write to database table.", exception);
}
}
/* Statements */
- public MSqlStatementResults executePreparedStatement(String statement) throws MStatementSqlException {
+ public MSqlStatementResults executePreparedStatement(String statement) throws MSqlStatementException {
return this.executePreparedStatement(statement, new LinkedList<Object>());
}
- public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters) throws MStatementSqlException {
+ public MSqlStatementResults executePreparedStatement(String statement, LinkedList<Object> parameters) throws MSqlStatementException {
if (MText.isBlank(statement)) {
throw new IllegalArgumentException("Invalid 'statement': null or empty.");
}
if (MSqlConnection.TransactionStatus.SUCCESSFUL == this.getTransactionStatus()) {
this.setTransactionStatus(MSqlConnection.TransactionStatus.FAILED);
}
- throw new MStatementSqlException(String.format("Could not execute prepared statement: %s.", preparedStatement), exception);
+ throw new MSqlStatementException(String.format("Could not execute prepared statement: %s.", preparedStatement), exception);
}
return results;
}
--- /dev/null
+/**
+ * Macaco
+ * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco.sql;
+
+@SuppressWarnings("serial")
+public class MSqlStatementException extends MSqlException {
+
+ /* */
+
+ public MSqlStatementException() {
+ super();
+ }
+
+ public MSqlStatementException(String message) {
+ super(message);
+ }
+
+ public MSqlStatementException(Throwable error) {
+ super(error);
+ }
+
+ public MSqlStatementException(String message, Throwable error) {
+ super(message, error);
+ }
+
+}
/* */
- public MSqlStatementResults(PreparedStatement preparedStatement) throws MStatementSqlException {
+ public MSqlStatementResults(PreparedStatement preparedStatement) throws MSqlStatementException {
super();
//
if (null == preparedStatement) {
}
}
catch (SQLException exception) {
- throw new MStatementSqlException("Could not retrieve statement records.", exception);
+ throw new MSqlStatementException("Could not retrieve statement records.", exception);
}
//
try {
generatedKeysResultSet.close();
}
catch (SQLException exception) {
- throw new MStatementSqlException("Could not retrieve generated keys.", exception);
+ throw new MSqlStatementException("Could not retrieve generated keys.", exception);
}
}
/* Statements */
- protected MSqlStatementResults insertRecord(LinkedHashMap<String, Object> map) throws MStatementSqlException {
+ protected MSqlStatementResults insertRecord(LinkedHashMap<String, Object> map) throws MSqlStatementException {
if (null == map) {
throw new IllegalArgumentException("Invalid 'map': null.");
}
p);
}
- protected MSqlStatementResults updateRecord(LinkedHashMap<String, Object> map, Object id) throws MStatementSqlException {
+ protected MSqlStatementResults updateRecord(LinkedHashMap<String, Object> map, Object id) throws MSqlStatementException {
if (null == map) {
throw new IllegalArgumentException("Invalid 'map': null.");
}
p);
}
- public MSqlStatementResults setRecord(LinkedHashMap<String, Object> map, Object id) throws MStatementSqlException {
+ public MSqlStatementResults setRecord(LinkedHashMap<String, Object> map, Object id) throws MSqlStatementException {
if (null == id) {
return this.insertRecord(map);
}
}
}
- public MSqlStatementResults getRecord(Object id) throws MStatementSqlException {
+ public MSqlStatementResults getRecord(Object id) throws MSqlStatementException {
if (null == id) {
throw new IllegalArgumentException("Invalid 'id': null.");
}
p);
}
- public MSqlStatementResults deleteRecord(Object id) throws MStatementSqlException {
+ public MSqlStatementResults deleteRecord(Object id) throws MSqlStatementException {
if (null == id) {
throw new IllegalArgumentException("Invalid 'id': null.");
}
p);
}
- public MSqlStatementResults deleteRecords(LinkedHashSet idSet) throws MStatementSqlException {
+ public MSqlStatementResults deleteRecords(LinkedHashSet idSet) throws MSqlStatementException {
if (null == idSet) {
throw new IllegalArgumentException("Invalid 'idSet': null.");
}
+++ /dev/null
-/**
- * Macaco
- * Copyright (c) 2009-2015 Marco Zanon <info@marcozanon.com>.
- * Released under MIT license (see LICENSE for details).
- */
-
-package com.marcozanon.macaco.sql;
-
-@SuppressWarnings("serial")
-public class MStatementSqlException extends MSqlException {
-
- /* */
-
- public MStatementSqlException() {
- super();
- }
-
- public MStatementSqlException(String message) {
- super(message);
- }
-
- public MStatementSqlException(Throwable error) {
- super(error);
- }
-
- public MStatementSqlException(String message, Throwable error) {
- super(message, error);
- }
-
-}