1 package com.internetcds.jdbc.tds; 2 3 import java.sql.SQLException ; 4 import java.sql.SQLWarning ; 5 6 13 class SQLWarningChain { 14 public static final String cvsVersion = "$Id: SQLWarningChain.java,v 1.1 2006/06/23 10:39:30 sinisa Exp $"; 15 16 private SQLWarning warnings; 17 18 SQLWarningChain () 19 { 20 warnings = null; 21 } 22 23 27 synchronized SQLWarning getWarnings() { 28 return warnings; 29 } 30 31 35 synchronized void clearWarnings() { 36 warnings = null; 37 } 38 39 42 synchronized void addWarning(SQLWarning warn) { 43 if (warnings == null) { 44 warnings = warn; 45 } else { 46 warnings.setNextWarning(warn); 47 } 48 } 49 50 54 SQLException addOrReturn(PacketMsgResult pack) { 55 if (pack instanceof PacketErrorResult) { 56 return pack.getMsg().toSQLException(); 57 } else { 58 addWarning(pack.getMsg().toSQLWarning()); 59 return null; 60 } 61 } 62 } 63 64 | Popular Tags |