Maor Lipchuk has posted comments on this change.

Change subject: core: Exaple: Use UUID for handling database Guids
......................................................................


Patch Set 1: Looks good to me, but someone else must approve

(4 inline comments)

See minor comments/questions inside

....................................................
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/BaseDAODbFacade.java
Line 122:      * @throws SQLException If resultSet does not contain columnName 
or its value cannot be cast to {@link UUID}.
Line 123:      */
Line 124:     private static Guid getGuid(ResultSet resultSet, String 
columnName, Guid defaultValue) throws SQLException {
Line 125:         UUID uuid = (UUID) resultSet.getObject(columnName);
Line 126:         if (uuid == null || resultSet.wasNull()) {
Isn't resultSet.wasNull() should be enough here?
Line 127:             return defaultValue;
Line 128:         }
Line 129:         return new Guid(uuid);
Line 130:     }


Line 130:     }
Line 131: 
Line 132:     /**
Line 133:      * Returns a {@link Guid} representing the column's value or a 
<code>null</code>
Line 134:      * if the column was <code>null</code>.
perhaps "column value was null" or "field was null" is more clear then the 
"column was null"
Line 135:      *
Line 136:      * <b>Note:</b> Postgres' driver returns a {@link UUID} when 
{@link ResultSet#getObject(String)} is called on a
Line 137:      * uuid column. This behavior is trusted to work with Postgres 
8.x and 9.x and is used to achieve the best
Line 138:      * performance. If it is ever broken on Postgres' side, this 
method should be rewritten.


Line 134:      * if the column was <code>null</code>.
Line 135:      *
Line 136:      * <b>Note:</b> Postgres' driver returns a {@link UUID} when 
{@link ResultSet#getObject(String)} is called on a
Line 137:      * uuid column. This behavior is trusted to work with Postgres 
8.x and 9.x and is used to achieve the best
Line 138:      * performance. If it is ever broken on Postgres' side, this 
method should be rewritten.
It's a matter of style, but maybe we can neglect the Postgres versions, since 
many  changes that we do are counting on the postgres version
Line 139:      *
Line 140:      * @param resultSet the ResultSet to extract the result from.
Line 141:      * @param columnName the name of the column.
Line 142:      * @return a {@link Guid} representing the UUID in the column, or 
the default value if it was <code>null</code>.


....................................................
Commit Message
Line 3: AuthorDate: 2013-07-01 08:50:39 +0300
Line 4: Commit:     Allon Mureinik <[email protected]>
Line 5: CommitDate: 2013-07-01 09:33:41 +0300
Line 6: 
Line 7: core: Exaple: Use UUID for handling database Guids
/s/Exaple/Example
Line 8: 
Line 9: The Postgres JDBC Driver natively supports the java.lang.UUID type as a
Line 10: representation of a database uuid, in both directions -
Line 11: 1. ResultSet#getOtbject(int) and ResultSet#getObject(String) return a


-- 
To view, visit http://gerrit.ovirt.org/16281
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I4d30e1ab7303ecad68dbc9005ac5c6ef733f1707
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Greg Padgett <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Mike Kolesnik <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: Yair Zaslavsky <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to