1 21 22 package org.apache.derby.client.am; 23 24 import java.sql.SQLWarning ; 25 import org.apache.derby.iapi.services.info.JVMInfo; 26 27 34 public class SqlWarning extends SqlException implements Diagnosable { 35 36 protected SqlWarning nextWarning_; 37 38 public SqlWarning(LogWriter logwriter, 39 ClientMessageId msgid, Object [] args, Throwable cause) 40 { 41 super(logwriter, msgid, args, cause); 42 } 43 44 public SqlWarning(LogWriter logwriter, ClientMessageId msgid, Object [] args) 45 { 46 this(logwriter, msgid, args, null); 47 } 48 49 public SqlWarning (LogWriter logwriter, ClientMessageId msgid) 50 { 51 super(logwriter, msgid); 52 } 53 54 public SqlWarning(LogWriter logwriter, ClientMessageId msgid, Object arg1) 55 { 56 super(logwriter, msgid, arg1); 57 } 58 59 public SqlWarning(LogWriter logwriter, 60 ClientMessageId msgid, Object arg1, Object arg2) 61 { 62 super(logwriter, msgid, arg1, arg2); 63 } 64 65 public SqlWarning(LogWriter logwriter, 66 ClientMessageId msgid, Object arg1, Object arg2, Object arg3) 67 { 68 super(logwriter, msgid, arg1, arg2, arg3); 69 } 70 71 public SqlWarning(LogWriter logWriter, Sqlca sqlca) 72 { 73 super(logWriter, sqlca); 74 } 75 76 public void setNextWarning(SqlWarning warning) 77 { 78 SqlWarning theEnd = this; 80 while (theEnd.nextWarning_ != null) { 81 theEnd = theEnd.nextWarning_; 82 } 83 theEnd.nextWarning_ = warning; 84 } 85 86 public SqlWarning getNextWarning() 87 { 88 return nextWarning_; 89 } 90 91 94 public SQLWarning getSQLWarning() 95 { 96 SQLWarning sqlw = new SQLWarning (getMessage(), getSQLState(), 97 getErrorCode()); 98 99 if (JVMInfo.JDK_ID >= JVMInfo.J2SE_14 ) 102 { 103 sqlw.initCause(this); 104 } 105 106 if ( nextWarning_ != null ) 108 { 109 sqlw.setNextException( 117 nextException_ instanceof SqlWarning ? 118 ((SqlWarning)nextException_).getSQLWarning() : 119 nextException_.getSQLException()); 120 } 121 122 return sqlw; 123 124 } 125 } 126 127 | Popular Tags |