Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit29ea8ff

Browse files
author
Dave Cramer
committed
Patch by Nicolas Verger to correctly propogate SQLWarning to the Statement and ResultSet
1 parentff2f9b6 commit29ea8ff

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

‎src/interfaces/jdbc/org/postgresql/ResultSet.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,5 +223,37 @@ public String getFixedString(int col) throws SQLException
223223

224224
returns;
225225
}
226+
227+
/**
228+
* The first warning reported by calls on this ResultSet is
229+
* returned. Subsequent ResultSet warnings will be chained
230+
* to this SQLWarning.
231+
*
232+
* <p>The warning chain is automatically cleared each time a new
233+
* row is read.
234+
*
235+
* <p><B>Note:</B> This warning chain only covers warnings caused by
236+
* ResultSet methods. Any warnings caused by statement methods
237+
* (such as reading OUT parameters) will be chained on the
238+
* Statement object.
239+
*
240+
* @return the first SQLWarning or null;
241+
* @exception SQLException if a database access error occurs.
242+
*/
243+
publicSQLWarninggetWarnings()throwsSQLException
244+
{
245+
returnwarnings;
246+
}
247+
248+
/**
249+
* Add a warning chain to the current warning chain
250+
* @param warnings warnings to add
251+
*/
252+
publicvoidaddWarnings(SQLWarningwarnings) {
253+
if (this.warnings !=null )
254+
this.warnings.setNextWarning(warnings);
255+
else
256+
this.warnings =warnings;
257+
}
226258
}
227259

‎src/interfaces/jdbc/org/postgresql/Statement.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@ public void setQueryTimeout(int seconds) throws SQLException
110110
timeout =seconds;
111111
}
112112

113+
/**
114+
* This adds a warning to the warning chain.
115+
* @param msg message to add
116+
*/
117+
publicvoidaddWarning(Stringmsg)
118+
{
119+
if (warnings !=null)
120+
warnings.setNextWarning(newSQLWarning(msg));
121+
else
122+
warnings =newSQLWarning(msg);
123+
}
124+
113125
/*
114126
* The first warning reported by calls on this Statement is
115127
* returned. A Statement's execute methods clear its SQLWarning

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp