Jump to content
  • 0

Question

Posted
con=L2DatabaseFactory.getInstance().getConnection()

rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")

rem.setString(1, scheme)

rem.setString(2, skill)

rem.setString(3, level)

try :

rem.executeUpdate()

except :

pass

if getBuffCount(scheme) == 0 :

HTML = getOptionList(scheme)

else :

HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove")

return HTML

 

if event == "add_buff" :

event = eventParam1.split("_")

scheme = event[0]

skill = event[1]

level = event[2]

idbuffclass = getclassbuff(skill)

con=L2DatabaseFactory.getInstance().getConnection()

ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)")

ins.setString(1, str(scheme))

ins.setString(2, str(skill))

ins.setString(3, str(level))

ins.setString(4, str(idbuffclass))

try :

ins.executeUpdate()

ins.close()

con.close()

 

As we can see there is once unclosed connection!

Where should i put close() i am not sure so i am asking you guys!

1 answer to this question

Recommended Posts

  • 0
Posted

try :

        rem.executeUpdate()

        rem.close()

        con.close()

except :

        pass

 

Don't yeil at me if it's wrong, that's how the 2nd exemple is written.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...