*
* @throws SQLWarning
*/
private void throwSQLWarning(String msg) throws SQLWarning
{
SQLWarning se = null;
SQLWarning ne;
SQLWarning ce = null;
StringBuffer strbuf = new StringBuffer();
StringTokenizer tokenizer = new StringTokenizer(msg, "\n");
String sqlstate = null;
String str;
while (tokenizer.hasMoreTokens())
{
str = tokenizer.nextToken();
//start of the next message
if (str.charAt(5) == ':')
{
if (strbuf.length() > 0)
{
if (se == null)
{
se = new SQLWarning(strbuf.toString(), sqlstate);
ce = se;
}
else
{
ne = new SQLWarning(strbuf.toString(), sqlstate);
ce.setNextException(ne);
ce = ne;
}
strbuf = new StringBuffer();
}
strbuf.append(str.substring(6));
sqlstate = str.substring(0,5);
}
else
strbuf.append(str);
}
if (strbuf.length() > 0)
{
if (se == null)
{
se = new SQLWarning(strbuf.toString(), sqlstate);
ce = se;
}
else
{
ne = new SQLWarning(strbuf.toString(), sqlstate);
ce.setNextException(ne);
ce = ne;
}
}
throw se;
}