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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock