sqlmap-session.xml
1.47 KB
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="session">
<insert id="createSession">
REPLACE INTO tbl_session (sessionkey, uid, update_time, create_time, ip, persist, post_id, logout_id,src) VALUES (:sessionkey, :uid, :lasttime, :createtime, :createip, :persist, :postid, :logoutid,:src)
</insert>
<delete id="deleteSession">
DELETE FROM tbl_session WHERE sessionkey = :sessionkey
</delete>
<delete id="deleteSessionByUid">
DELETE FROM tbl_session WHERE uid = :uid
</delete>
<select id="getSession">
SELECT * FROM tbl_session WHERE sessionkey = :sessionkey
</select>
<select id="updateSession">
UPDATE tbl_session SET #upstring# WHERE sessionkey = :sessionkey
</select>
<select id="getGcSessionsCounter">
SELECT count(sessionkey) FROM tbl_session WHERE (persist == 'n' AND update_time <= :templife) OR (persist == 'y' AND update_time <= :persistlife)
</select>
<select id="getGcSessions">
SELECT sessionkey FROM tbl_session WHERE (persist == 'n' AND update_time <= :templife) OR (persist == 'y' AND update_time <= :persistlife)
</select>
<delete id="gcSessions">
DELETE FROM tbl_session WHERE (persist == 'N' AND update_time <= :templife) OR (persist == 'Y' AND update_time <= :persistlife)
</delete>
<select id="getUserSessions">
SELECT sessionkey FROM tbl_session WHERE uid IN (#rs#)
</select>
<select id="getUserLastSession">
SELECT sessionkey FROM tbl_session WHERE uid = :uid ORDER BY update_time DESC LIMIT 1
</select>
</sqlMap>