Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapters
Message
 
 
To
21/01/2005 04:47:27
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Oracle
Miscellaneous
Thread ID:
00979005
Message ID:
00979269
Views:
13
You can open/close the connection when you open/close the form. Some customers have systems where connections are at a premium, so connections need to be closed as soon as possible as well as shared. Each cursor can have its own connection or use a shared connection. If you have multiple cursors that are involved in the same transaction, personally, I would use the same connection. If each cursor has its own connection, you have to issue a SQLCOMMIT or SQLROLLBACK on each cursor/connection. If the cursors are using the same connection, then the transactions for all the cursors can be committed or rolled back with one command.

Cursors with interdependent transactions could share the same connection. In other words, if Cursor1 and Cursor2 have transactions that all have to be successful or be rolled back, then those 2 could share a connection. While Cursor3 and Cursor4 whose transactions or dependent on each others success, could share a different connection.

If all cursors' transactions are independent of each other, then each coursor could use separate connection. If all use the same connection, each cursor has to be processed individually then have those transactions committed or rolled back before the next cursor is processed.

As you can see, there are endless possibilities and combinations here. So you have to decide what is the best way for your situation.

I have a connection manager class whose sole responsibility is to open and close connections. This class has a property that holds the value of the handle. My GetHandle() procedure is in a generic PRG file of PROCs that I SET PROCEDURE TO at app startup. This GetHandle proc is responsible for returning the connection handle to whatever calls it. In this case, GetHandle() in the DataSource property of the CA is executed at runtime and returns the numeric handle value to this property. I actually have to put =GetHandle() in the DataSource property of the CA for the proc to be called.

>So from what you are saying, I need to open the connection somewhere before I open any forms and leave it open until I close the app. Where would you recommend opening the connection?
>
>So I would open the connection somewhere, store the connection handle in a property. I would set my CA's to have a datasource of the connection number and modify the sqlstring connect with .T. for the shared field).
>
>
>At current I have not opened a seperate connection. I a, letting the CA's handle them. But I have the .T. set for shared. I am however getting my update hanging on the 4th CA in a transaction. I am currently handling the update process almost identically to how I was doing views with setting the transaction to manual, then in a transaction I do table updates followed by sqlcommits.
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform