GUAC-1103: Explicitly cast strings to integers.

This commit is contained in:
Michael Jumper
2015-03-02 20:03:44 -08:00
parent dbab6acd2c
commit 187f61b483
6 changed files with 29 additions and 29 deletions

View File

@@ -54,7 +54,7 @@
SELECT connection_id SELECT connection_id
FROM guacamole_connection FROM guacamole_connection
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
</select> </select>
@@ -64,7 +64,7 @@
FROM guacamole_connection FROM guacamole_connection
JOIN guacamole_connection_permission ON guacamole_connection_permission.connection_id = guacamole_connection.connection_id JOIN guacamole_connection_permission ON guacamole_connection_permission.connection_id = guacamole_connection.connection_id
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -82,7 +82,7 @@
WHERE connection_id IN WHERE connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}::integer
</foreach> </foreach>
</select> </select>
@@ -100,7 +100,7 @@
WHERE guacamole_connection.connection_id IN WHERE guacamole_connection.connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}::integer
</foreach> </foreach>
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -117,7 +117,7 @@
protocol protocol
FROM guacamole_connection FROM guacamole_connection
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
AND connection_name = #{name,jdbcType=VARCHAR} AND connection_name = #{name,jdbcType=VARCHAR}
@@ -126,7 +126,7 @@
<!-- Delete single connection by identifier --> <!-- Delete single connection by identifier -->
<delete id="delete"> <delete id="delete">
DELETE FROM guacamole_connection DELETE FROM guacamole_connection
WHERE connection_id = #{identifier,jdbcType=INTEGER} WHERE connection_id = #{identifier,jdbcType=INTEGER}::integer
</delete> </delete>
<!-- Insert single connection --> <!-- Insert single connection -->
@@ -140,7 +140,7 @@
) )
VALUES ( VALUES (
#{object.name,jdbcType=VARCHAR}, #{object.name,jdbcType=VARCHAR},
#{object.parentIdentifier,jdbcType=INTEGER}, #{object.parentIdentifier,jdbcType=INTEGER}::integer,
#{object.protocol,jdbcType=VARCHAR} #{object.protocol,jdbcType=VARCHAR}
) )
@@ -150,9 +150,9 @@
<update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel"> <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connection.ConnectionModel">
UPDATE guacamole_connection UPDATE guacamole_connection
SET connection_name = #{object.name,jdbcType=VARCHAR}, SET connection_name = #{object.name,jdbcType=VARCHAR},
parent_id = #{object.parentIdentifier,jdbcType=INTEGER}, parent_id = #{object.parentIdentifier,jdbcType=INTEGER}::integer,
protocol = #{object.protocol,jdbcType=VARCHAR} protocol = #{object.protocol,jdbcType=VARCHAR}
WHERE connection_id = #{object.objectID,jdbcType=INTEGER} WHERE connection_id = #{object.objectID,jdbcType=INTEGER}::integer
</update> </update>
</mapper> </mapper>

View File

@@ -47,7 +47,7 @@
FROM guacamole_connection_history FROM guacamole_connection_history
JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id JOIN guacamole_user ON guacamole_connection_history.user_id = guacamole_user.user_id
WHERE WHERE
connection_id = #{identifier,jdbcType=INTEGER} connection_id = #{identifier,jdbcType=INTEGER}::integer
ORDER BY ORDER BY
start_date DESC, start_date DESC,
end_date DESC end_date DESC
@@ -64,7 +64,7 @@
end_date end_date
) )
VALUES ( VALUES (
#{record.connectionIdentifier,jdbcType=INTEGER}, #{record.connectionIdentifier,jdbcType=INTEGER}::integer,
#{record.userID,jdbcType=INTEGER}, #{record.userID,jdbcType=INTEGER},
#{record.startDate,jdbcType=TIMESTAMP}, #{record.startDate,jdbcType=TIMESTAMP},
#{record.endDate,jdbcType=TIMESTAMP} #{record.endDate,jdbcType=TIMESTAMP}

View File

@@ -41,13 +41,13 @@
parameter_value parameter_value
FROM guacamole_connection_parameter FROM guacamole_connection_parameter
WHERE WHERE
connection_id = #{identifier,jdbcType=INTEGER} connection_id = #{identifier,jdbcType=INTEGER}::integer
</select> </select>
<!-- Delete all parameters of a given connection --> <!-- Delete all parameters of a given connection -->
<delete id="delete"> <delete id="delete">
DELETE FROM guacamole_connection_parameter DELETE FROM guacamole_connection_parameter
WHERE connection_id = #{identifier,jdbcType=INTEGER} WHERE connection_id = #{identifier,jdbcType=INTEGER}::integer
</delete> </delete>
<!-- Insert all given parameters --> <!-- Insert all given parameters -->
@@ -60,7 +60,7 @@
) )
VALUES VALUES
<foreach collection="parameters" item="parameter" separator=","> <foreach collection="parameters" item="parameter" separator=",">
(#{parameter.connectionIdentifier,jdbcType=INTEGER}, (#{parameter.connectionIdentifier,jdbcType=INTEGER}::integer,
#{parameter.name,jdbcType=VARCHAR}, #{parameter.name,jdbcType=VARCHAR},
#{parameter.value,jdbcType=VARCHAR}) #{parameter.value,jdbcType=VARCHAR})
</foreach> </foreach>

View File

@@ -55,7 +55,7 @@
SELECT connection_group_id SELECT connection_group_id
FROM guacamole_connection_group FROM guacamole_connection_group
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
</select> </select>
@@ -65,7 +65,7 @@
FROM guacamole_connection_group FROM guacamole_connection_group
JOIN guacamole_connection_group_permission ON guacamole_connection_group_permission.connection_group_id = guacamole_connection_group.connection_group_id JOIN guacamole_connection_group_permission ON guacamole_connection_group_permission.connection_group_id = guacamole_connection_group.connection_group_id
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -101,7 +101,7 @@
WHERE guacamole_connection_group.connection_group_id IN WHERE guacamole_connection_group.connection_group_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}::integer
</foreach> </foreach>
AND user_id = #{user.objectID,jdbcType=INTEGER} AND user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = 'READ' AND permission = 'READ'
@@ -118,7 +118,7 @@
type type
FROM guacamole_connection_group FROM guacamole_connection_group
WHERE WHERE
<if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}</if> <if test="parentIdentifier != null">parent_id = #{parentIdentifier,jdbcType=INTEGER}::integer</if>
<if test="parentIdentifier == null">parent_id IS NULL</if> <if test="parentIdentifier == null">parent_id IS NULL</if>
AND connection_group_name = #{name,jdbcType=VARCHAR} AND connection_group_name = #{name,jdbcType=VARCHAR}
@@ -127,7 +127,7 @@
<!-- Delete single connection group by identifier --> <!-- Delete single connection group by identifier -->
<delete id="delete"> <delete id="delete">
DELETE FROM guacamole_connection_group DELETE FROM guacamole_connection_group
WHERE connection_group_id = #{identifier,jdbcType=INTEGER} WHERE connection_group_id = #{identifier,jdbcType=INTEGER}::integer
</delete> </delete>
<!-- Insert single connection --> <!-- Insert single connection -->
@@ -141,7 +141,7 @@
) )
VALUES ( VALUES (
#{object.name,jdbcType=VARCHAR}, #{object.name,jdbcType=VARCHAR},
#{object.parentIdentifier,jdbcType=INTEGER}, #{object.parentIdentifier,jdbcType=INTEGER}::integer,
#{object.type,jdbcType=VARCHAR} #{object.type,jdbcType=VARCHAR}
) )
@@ -151,9 +151,9 @@
<update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel"> <update id="update" parameterType="org.glyptodon.guacamole.auth.jdbc.connectiongroup.ConnectionGroupModel">
UPDATE guacamole_connection_group UPDATE guacamole_connection_group
SET connection_group_name = #{object.name,jdbcType=VARCHAR}, SET connection_group_name = #{object.name,jdbcType=VARCHAR},
parent_id = #{object.parentIdentifier,jdbcType=INTEGER}, parent_id = #{object.parentIdentifier,jdbcType=INTEGER}::integer,
type = #{object.type,jdbcType=VARCHAR} type = #{object.type,jdbcType=VARCHAR}
WHERE connection_group_id = #{object.objectID,jdbcType=INTEGER} WHERE connection_group_id = #{object.objectID,jdbcType=INTEGER}::integer
</update> </update>
</mapper> </mapper>

View File

@@ -62,7 +62,7 @@
WHERE WHERE
guacamole_connection_group_permission.user_id = #{user.objectID,jdbcType=INTEGER} guacamole_connection_group_permission.user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type
AND connection_group_id = #{identifier,jdbcType=INTEGER} AND connection_group_id = #{identifier,jdbcType=INTEGER}::integer
</select> </select>
@@ -76,7 +76,7 @@
AND connection_group_id IN AND connection_group_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}::integer
</foreach> </foreach>
AND permission IN AND permission IN
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
@@ -112,7 +112,7 @@
<foreach collection="permissions" item="permission" separator=","> <foreach collection="permissions" item="permission" separator=",">
(#{permission.userID,jdbcType=INTEGER}, (#{permission.userID,jdbcType=INTEGER},
#{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type, #{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type,
#{permission.objectIdentifier,jdbcType=INTEGER}) #{permission.objectIdentifier,jdbcType=INTEGER}::integer)
</foreach> </foreach>
</insert> </insert>

View File

@@ -62,7 +62,7 @@
WHERE WHERE
guacamole_connection_permission.user_id = #{user.objectID,jdbcType=INTEGER} guacamole_connection_permission.user_id = #{user.objectID,jdbcType=INTEGER}
AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type AND permission = #{type,jdbcType=VARCHAR}::guacamole_object_permission_type
AND connection_id = #{identifier,jdbcType=INTEGER} AND connection_id = #{identifier,jdbcType=INTEGER}::integer
</select> </select>
@@ -76,7 +76,7 @@
AND connection_id IN AND connection_id IN
<foreach collection="identifiers" item="identifier" <foreach collection="identifiers" item="identifier"
open="(" separator="," close=")"> open="(" separator="," close=")">
#{identifier,jdbcType=INTEGER} #{identifier,jdbcType=INTEGER}::integer
</foreach> </foreach>
AND permission IN AND permission IN
<foreach collection="permissions" item="permission" <foreach collection="permissions" item="permission"
@@ -95,7 +95,7 @@
open="(" separator="," close=")"> open="(" separator="," close=")">
(#{permission.userID,jdbcType=INTEGER}, (#{permission.userID,jdbcType=INTEGER},
#{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type, #{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type,
#{permission.objectIdentifier,jdbcType=INTEGER}) #{permission.objectIdentifier,jdbcType=INTEGER}::integer)
</foreach> </foreach>
</delete> </delete>
@@ -112,7 +112,7 @@
<foreach collection="permissions" item="permission" separator=","> <foreach collection="permissions" item="permission" separator=",">
(#{permission.userID,jdbcType=INTEGER}, (#{permission.userID,jdbcType=INTEGER},
#{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type, #{permission.type,jdbcType=VARCHAR}::guacamole_object_permission_type,
#{permission.objectIdentifier,jdbcType=INTEGER}) #{permission.objectIdentifier,jdbcType=INTEGER}::integer)
</foreach> </foreach>
</insert> </insert>