Page 9 of 14

PostPosted: Wed May 16, 2007 6:39 am
by Enrico Maria Giordano
Milan Mehta wrote:Dear All,

I am quite excited about the possibility of Using Access and MySql in my program. I have always resisted using the same as I needed to alter my programming style and it also required some other program to be installed on client machine.


Please note that ADORDD uses ADO and therefore nothing changes on the side of the required components.

EMG

PostPosted: Wed May 16, 2007 7:00 am
by Antonio Linares
Milan,

>
I will highly appreciate, if somebody can show me, how can I ?
- Create a Table (in a Database)
>

DbCreate(), please review the provided samples with ADORDD

> - Open the Table

USE ... please review ADORDD.ch

> - Index the Table

INDEX ON ... TO ...

> - Seek a particularly Value

SEEK ...

> - Set the filter

SET FILTER TO ...

ADORDD is used as another Harbour RDD, using the Clipper language syntax :-)

PostPosted: Wed May 16, 2007 12:28 pm
by jose_murugosa
Antonio,

Does ADORDD work with Postgre SQL?

Is there any difference in sintax?

PostPosted: Wed May 16, 2007 12:46 pm
by Antonio Linares
José,

We have already answered you at the spanish forum :-)

PostPosted: Fri Jun 01, 2007 10:34 am
by Enrico Maria Giordano
Is SEEK implemented. It seems not. If not, will it be? I think that ADORDD is not so useful without SEEK.

Same for locking. RLOCK() seems to always return .T.

EMG

PostPosted: Fri Jun 01, 2007 11:16 am
by Antonio Linares
Enrico,

Please test this:

#define adSeek 0x200000

MsgInfo( HB_AdoRddGetRecordset():Supports( adSeek ) )

If the recordset does not support such functionality then there is no way to use SEEK using ADO. Its an ADO feature/limitation issue

Regarding the RLock():
Actually ADORDD returns true, because in fact the locking is handled by the server and depends on the open mode of the ADO Recordset

PostPosted: Fri Jun 01, 2007 12:33 pm
by Enrico Maria Giordano
Antonio Linares wrote:Enrico,

Please test this:

#define adSeek 0x200000

MsgInfo( HB_AdoRddGetRecordset():Supports( adSeek ) )

If the recordset does not support such functionality then there is no way to use SEEK using ADO. Its an ADO feature/limitation issue


It returns .F. with MDB. Can you or anybody else test it under MySQL or MS SQL Server, please?

Anyway my question was if SEEK is currently implemented or will be in future.

Antonio Linares wrote:Regarding the RLock():
Actually ADORDD returns true, because in fact the locking is handled by the server and depends on the open mode of the ADO Recordset


I know. Do you have any ideas on how to prevent two users working on the same record (ie. opening the same dialog) at the same time?

EMG

PostPosted: Fri Jun 01, 2007 3:35 pm
by Antonio Linares
Enrico,

>
It returns .F. with MDB. Can you or anybody else test it under MySQL or MS SQL Server, please?
>

Rick Lipkin tested Supports( adIndex ) with MS SQL Server and returned false too. Rick, could you test Supports( adSeek ) ? Thanks,

>
Anyway my question was if SEEK is currently implemented or will be in future.
>

Its not currently implemented, but its very easy, just one line source code:

http://www.w3schools.com/ado/met_rs_seek.asp

> Do you have any ideas on how to prevent two users working on the same record (ie. opening the same dialog) at the same time?

Probably the easiest way is to add a field "Locked" and turn it true or false

PostPosted: Fri Jun 01, 2007 3:53 pm
by Enrico Maria Giordano
Antonio Linares wrote:Rick Lipkin tested Supports( adIndex ) with MS SQL Server and returned false too. Rick, could you test Supports( adSeek ) ?


I'm interested in MySQL support. Anybody that is using it?

Antonio Linares wrote:Its not currently implemented, but its very easy, just one line source code:

http://www.w3schools.com/ado/met_rs_seek.asp


I wonder how can SEEK work if SET INDEX doesn't. Maybe both are working with MySQL?

Antonio Linares wrote:Probably the easiest way is to add a field "Locked" and turn it true or false


I know. But there is a problem: if a terminal crash then the lock is stucked to true.

EMG

PostPosted: Fri Jun 01, 2007 4:01 pm
by Antonio Linares
Enrico,

> I know. But there is a problem: if a terminal crash then the lock is stucked to true.

A remote procedure may help on that circunstance

PostPosted: Fri Jun 01, 2007 4:03 pm
by Enrico Maria Giordano
Interesting. Can you be more explicit?

EMG

PostPosted: Fri Jun 01, 2007 4:06 pm
by Antonio Linares
Enrico,

Its just an idea, I have not tried it and don't know if it may be a valid solution

PostPosted: Fri Jun 01, 2007 4:12 pm
by Enrico Maria Giordano
Ah, ok. Thanks anyway.

EMG

PostPosted: Fri Jun 01, 2007 10:10 pm
by Rick Lipkin
Antonio and Enrico

To the best of my knowledge MS SQL ( for a fact ) and Oracle databases do not use indexes in a traditional way and ADO can not access them for a seek ..

I have found that the plain old oRs:Find( cSQL ) works just fine and is VERY fast !! ( 30k records running over a T1 wan ) .. something like this code snipit Enrico helped me with :

oRs:MoveFirst()
oRs:Find("reg_no = '"+cFIND+"'" )

IF oRs:eof
oRs:MoveFirst()

xFIND := "reg_no like '"+cFIND+"%'"
oRs:Find( xFIND )

IF oRs:eof()
Msginfo( "Reg Number "+cFind+" can not be found" )
oRs:MoveFirst()
ENDIF
ENDIF

This code seems to work on .mdb and SQL Server and I venture to guess all ADO databases .. and to me would be the best common denominator for wrapping ( seek ) into Ado RDD ..

Just my thoughts
Rick Lipkin

PostPosted: Fri Jun 01, 2007 10:33 pm
by Enrico Maria Giordano
Rick Lipkin wrote:oRs:MoveFirst()
oRs:Find("reg_no = '"+cFIND+"'" )


Great! Then it seems that SEEK can be implemented via Find() method without the need of SET INDEX. One could eventually add indexes to database to speed up the search.

Antonio?

EMG