From: Patrick D. <pat...@ac...> - 2009-02-17 17:27:45
|
In the documentation we have the following: $resultset close The close object command deletes the result set and frees any associated system resources. If you do not close the result set each time, does tdbc automatically clean up the system resources on the subsequent prepare / execute? In other words, besides being good practice is it required? Thanks Patrick Dunnigan Email: pat...@ac... Visit us at <file:///C:\Documents%20and%20Settings\pdunnigan\Application%20Data\Microsof t\Signatures\www.activecompliance.com> www.activecompliance.com This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is confidential. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email. |
From: Kevin K. <kk...@ny...> - 2009-02-18 05:37:01
|
Patrick Dunnigan wrote: > In the documentation we have the following: > > > > /$resultset/ *close* > > The *close* object command deletes the result set and frees any > associated system resources. > > > > If you do not close the result set each time, does tdbc automatically > clean up the system resources on the subsequent prepare / execute? In > other words, besides being good practice is it required? Yes, it's required. You can have as many prepared statements per connection as you please, and as many result sets per statement as you please. Close them when you're done with them. -- 73 de ke9tv/2, Kevin |
From: Patrick D. <pat...@ac...> - 2009-02-19 16:12:33
|
Are there any resources wasted if I do the following: set sql "update mytable set column1 = 'ABC123'" set result [[$conn prepare $sql] execute] and don't call $result close? In other words, for update / insert / etc. statements do we have to call $results close. Presently I am only calling $results close on select statements. However some of these processes run for days, even weeks or months on end so I don't want to cause a memory leak or whatever. Thanks, Patrick Dunnigan Email: pat...@ac... Visit us at www.activecompliance.com This e-mail message is intended only for the use of the individual or entity to which it is addressed, and may contain information that is confidential. If you are not the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by reply email. -----Original Message----- From: Kevin Kenny [mailto:kk...@ny...] Sent: Wednesday, February 18, 2009 12:39 AM To: pat...@ac... Cc: tcl...@li... Subject: Re: [Tcl-tdbc] $resultset close Yes, it's required. You can have as many prepared statements per connection as you please, and as many result sets per statement as you please. Close them when you're done with them. -- 73 de ke9tv/2, Kevin |
From: Kevin K. <kk...@ny...> - 2009-02-19 19:29:51
|
Patrick Dunnigan wrote: > Are there any resources wasted if I do the following: > > set sql "update mytable set column1 = 'ABC123'" > set result [[$conn prepare $sql] execute] > > > and don't call $result close? > > In other words, for update / insert / etc. statements do we have to call > $results close. > > Presently I am only calling $results close on select statements. However > some of these processes run for days, even weeks or months on end so I don't > want to cause a memory leak or whatever. Yes, all result sets, even ones of zero rows, must be closed. For INSERT, UPDATE and DELETE statements, I've taken to writing: $conn allrows {UPDATE mytable SET column1 = :input} because that makes a list of the zero rows of the result set and returns that empty list, cleaning up the prepared statement and the result set. I also tend to prepare my statements once in program initialization (or on demand) and keep them around. At least if there's a likelihood that I'll be using them more than once. -- 73 de ke9tv/2, Kevin |