One more COMate question (ADO)

Just starting out? Need help? Post your questions and find answers here.
sc4pb
User
User
Posts: 32
Joined: Tue Mar 07, 2023 5:33 pm

One more COMate question (ADO)

Post by sc4pb »

Thanks everyone, I have COMate up and running. I was hoping to port an app using ADO with a minimum of fuss, but I find this problem:

Using COMate I create ADO.Connection object and connect to database. ...like cn = COMate_CreateObject("ADODB.Connection")
Using COMate I create ADO.Recordset object, and set the properties I want for cursor etc (UseClient, OpenStatic)

...next I was going to recreate this call: recordsetOb.Open("MySQLStatement",ConnectionObject)

But, I find no way to pass the connection object (which I created earlier) in my recordsetOb\Invoke("Open"... call

The examples in the COMate docs show using recordset = connection\Invoke("Execute MySQLStatement") to get the recordset returned. That's fine, but this will always be a forward only cursor, I wanted to use additional recordset functions.

Any thoughts? Is there any way to pass the COMate connection to the COMate recordset during the open call?

(Thanks in advance, no worries if no one is using this library any more)
pfnuesu
New User
New User
Posts: 9
Joined: Tue May 03, 2022 8:17 pm

Re: One more COMate question (ADO)

Post by pfnuesu »

Hi

Would you like to share what kind of DB you're trying to access?

I still use COMate, but mostly to automate MS Office. When migrating my sources from Powerbasic to Purebasic I found that the integrated database library is quite powerful (and much faster).
sc4pb
User
User
Posts: 32
Joined: Tue Mar 07, 2023 5:33 pm

Re: One more COMate question (ADO)

Post by sc4pb »

This one happens to be SQL Server, but the issue is the ADO recordset object. Without a rewrite, it would have to support disconnected recordsets, So create a recordset, run the query with a client side static cursor. Then disconnect recordset from connection, and from then on you can filter, sort, re-sort, move first/last/next/prev, all with a client side snapshot of the data with no server activity.

COMate works great, except the only way to run a query seems to be connection.GetObjectProperty("query") which returns a recordset (the object.) This is always a forward-only recordset with no features like above. With COMate I can create a recordset object directly, and would be able to set my cursors and run the query as I like, but there is no way to specify the connection property (what connection object to use.) In other words, COMate does not have a SetObjectProperty method. If it did, I could specify the connection.

Awww, no worries, thanks for reply. I was just trying to figure out if I was missing something!
Post Reply