1 31 32 package org.opencms.db; 33 34 import org.opencms.i18n.CmsMessageContainer; 35 import org.opencms.main.CmsException; 36 37 import java.sql.Statement ; 38 39 import org.apache.commons.dbcp.DelegatingPreparedStatement; 40 41 50 public class CmsDbSqlException extends CmsDbException { 51 52 53 private static final long serialVersionUID = -286617872967617367L; 54 55 60 public CmsDbSqlException(CmsMessageContainer container) { 61 62 super(container); 63 } 64 65 71 public CmsDbSqlException(CmsMessageContainer container, Throwable cause) { 72 73 super(container, cause); 74 } 75 76 82 public static String getErrorQuery(Statement stmt) { 83 84 if (stmt != null) { 85 Statement s = stmt; 87 while (s instanceof DelegatingPreparedStatement) { 88 s = ((DelegatingPreparedStatement)s).getDelegate(); 89 } 90 if (s != null) { 91 return s.toString(); 93 } 94 } 95 return ""; 96 } 97 98 101 public CmsException createException(CmsMessageContainer container, Throwable cause) { 102 103 return new CmsDbSqlException(container, cause); 104 } 105 } | Popular Tags |