[bug report 2040] Vserver,
NOTE 2. HOW TO write client/server apps
Charles Yeomans
charles at declareSub.com
Wed Dec 13 15:30:56 CST 2006
On Dec 13, 2006, at 2:56 PM, Ruslan Zasukhin wrote:
> On 12/06/13 7:19 PM, "Charles Yeomans" <charles at declareSub.com> wrote:
>
>>>
>>>> AGREE. So the same must do code as
>>>
>>>>>> object1.open
>>>>>> object2.open()
>>>>>>
>>>>>> object2.close()
>>>> object1 = nil
>>>
>>>> Ivan, I believe this works in our case, right ?
>>>
>>> Yes. Destructor of connection close self before destroying.
>>
>> It appears to do so in the simplest test. But this code
>>
>> dim c as new VConnection("localhost", "sa", "sa")
>> c.Open
>> dim db as new VDatabase(c)
>> db.Open new FolderItem("testdb")
>> db.Close
>>
>> still eats up connections.
>
> Charles, wait.
>
> Above YOU and ME have told that Vconnection destructor must close
> connection.
>
> Right?
Right.
>
> Where you see in this code call of destructor of Vconnection?
>
> You think it must be called on exit of method?
> And it is not called? This can be checked in the V4RB_LOG.
It must be called, and it is called. I checked the V4RB log file.
>
> Then may be this is a RB bug ???
No such luck.
>
>
>> My report of this was closed with the
>> comment "THIS IS correct behavior!". But I fail to see how it can
>> be. All databases using this connection are closed. Yet when the
>> connection object is destroyed, the connection is not closed.
>
> Because connection cannot be closed by lower-lever db object.
>
> Above you show case when DESTRUCTOR of Vconnection is not called.
> Am I right?
I don't think so. The VConnection destructor is called, but the
connection is not closed. Here is the log output for the following
code.
dim c as new VConnection("localhost", "sa", "sa")
c.Open
dim db as new VDatabase(c)
db.Open new FolderItem("testdb")
db.Close
db = nil
Connection_Ctor2...
return
Connection_Open...
return
Database_Ctor...
PARAM: instance = 18583152
return
Database_Ctor_Client_VConnection...
PARAM: instance = 18583152
PARAM: inVConnection = 18573840
return
Database_Open...
PARAM: inDatabase = 18583152
PARAM: remote_db_name = "testdb"
return
Database_Close...
PARAM: inDatabase = 18583152
return
Database_Destructor...
PARAM: instance = 18583152
return
Connection_Dtor...
PARAM: instance = 18573840
return
More information about the Valentina
mailing list