1 21 22 package org.apache.derby.impl.jdbc; 23 24 import org.apache.derby.iapi.services.i18n.MessageService; 25 import org.apache.derby.iapi.error.ExceptionSeverity; 26 27 import org.apache.derby.iapi.error.StandardException; 28 29 import java.sql.SQLWarning ; 30 31 45 public class EmbedSQLWarning extends SQLWarning { 46 47 50 51 54 55 60 protected EmbedSQLWarning(String message, String sqlstate) { 61 62 super(message, sqlstate, ExceptionSeverity.WARNING_SEVERITY); 63 } 64 65 68 69 70 73 74 78 public String toString() { 79 return "SQL Warning: " + getMessage(); 80 } 81 82 public static SQLWarning newEmbedSQLWarning(String messageId) { 84 return newEmbedSQLWarning(messageId, null); 85 } 86 87 91 public static SQLWarning newEmbedSQLWarning(String messageId, 92 Object arg) { 93 return new EmbedSQLWarning( 94 MessageService.getCompleteMessage(messageId, new Object [] {arg}), 95 StandardException.getSQLStateFromIdentifier(messageId)); 96 } 97 98 102 public static SQLWarning generateCsSQLWarning(StandardException se) { 103 return new EmbedSQLWarning( 104 se.getMessage(), se.getSQLState()); 105 } 106 107 } 108 109 | Popular Tags |