Welcome Guest, Not a member yet? Register   Sign In
Datebase close() function
#21

[eluser]Randy Casburn[/eluser]
Hey - scratch my previous post. I figured out specifically why this is happening. Can you tell me again what motivated you to send the second request to insert the record? Was there a specific use case involved or did you make a coding (logic) error that was an OH NO type of thing?

Just curious.

Randy
#22

[eluser]Randy Casburn[/eluser]
@haraldo - I wanted you to know what the answer to this problem turned out to be.

So we go back to my very first reply to you and select option #2.

The connection to DB is, truly, being recreated just prior to the second (or any really) query being sent to the database. The reason for this is because of the logic CI uses. If the database object exists, but no connection exists, it blindly creates a connection prior to sending a valid SQL statement to the database.

If you look at your sequence, that makes sense. You instantiate the object, you use it, you close its connection, but the object persists.

Hope that all makes sense. I put up a challenge in the community to spark some conversation to see if the community thinks this should change. I also submitted a bug report to see if that would generate interest.

The Development team will not generally change the code base unless there is community support.

But I wanted to let you know the outcome of all this.

The thread is here:http://ellislab.com/forums/viewthread/95794/P0/
The bug report is here: http://codeigniter.com/bug_tracker/bug/5845/

Randy
#23

[eluser]haraldo[/eluser]
Hi Randy, No i've kept that array empty.

I was just double checking to make sure the connection was closed and tryed to test this by immediately doing a second insert after closing the connection.

Thanks randy for your interst in this. I've learnt a liitle bit more about hows these connections work.




Theme © iAndrew 2016 - Forum software by © MyBB