1 22 23 24 package com.mchange.v2.c3p0; 25 26 import java.sql.Connection ; 27 import java.sql.SQLException ; 28 import java.sql.SQLWarning ; 29 30 import com.mchange.v2.log.MLevel; 31 import com.mchange.v2.log.MLog; 32 import com.mchange.v2.log.MLogger; 33 34 public final class SQLWarnings 35 { 36 final static MLogger logger = MLog.getLogger( SQLWarnings.class ); 37 38 public static void logAndClearWarnings(Connection con) throws SQLException 39 { 40 if (logger.isLoggable(MLevel.INFO)) 41 { 42 for(SQLWarning w = con.getWarnings(); w != null; w = w.getNextWarning()) 43 logger.log(MLevel.INFO, w.getMessage(), w); 44 } 45 con.clearWarnings(); 46 } 47 48 } 49 | Popular Tags |