FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Converting DBFCDX to SQL (ADO)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Converting DBFCDX to SQL (ADO)
Posted: Sun May 19, 2013 11:58 PM
Rao,

For my personal development, I use a class derived from TDatabase, which handles both DBFs and RecordSets.
Methods and behaviour are identical.


Do you mean you are using the same class for both? I am having a hard time picturing this. Do you use IF/ELSE in every method? If so, why?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Converting DBFCDX to SQL (ADO)
Posted: Mon May 20, 2013 01:07 AM

Mr James

After I read your question, I looked back at my posting. I have to agree that the language was not accurate.

I have a class TAdoBase derived from TDataBase.
Both have the same methods and behave identically ( almost ).

Now for ADO I need to use TAdoBase class and for DBFs TDataBase class.
But what I do is I have also a connection class ( and other classes )
The connection class is a wrapper for ADODB.Connection object with more methods used regularly.

I can also create dummy connection object for DBFs with the same connection class. This works both for ado and rdd for DBFs

I open tables with the connection object:
example: oCn:OpenTable( "tablename or sql" )

If the connection object is for a normal RDBMS ( oracle, mssql, etc ) the object creates recordset and uses TAdoBase to open the table.

If the connection object is for DBFs it uses TDataBase for Tables ( like CUSTOMER.DBF, etc ) and TADOBase for SqlStatements ( like "SELECT ." ). Note: This uses both RDD and also ADO for DBaseIII.

I need to think about the provider only at the outset, whether I am connecting to Oracle, SqlServer or simply a folder with DBF tables. Once I establish the connection I now forget about the source. Even forget if I am working with ADO or DBF.

In the rest of my application:

oCon:OpenTable( "SELECT NAME,ADDRESS,DUES FROM CUSTOMER" ) returns TAdoBase table ( both for DBFs and RDBMS )

oCon:OpenTable( "CUSTOMER" ) returns TDataBase for DBF and TAdoBase for RDBMS.

Usage of the table is the same whether it is DBF, ADO or whatever.

At the same time I should agree that I do conditional coding in the application but that is minimal.

Hope I am clear

Note: This approach works for me because I belong to the school of thought who believe in opening connection once at the beginning of the application and closing at the end and I am seriously against opening a separate connection for each recordset. (a) This approach increases the strain on the server resources and (b) opening a connection adds to the time of opening recordset (not totally relevant today).

We see present day programmers open recordset and connection together. These are the examples we see often.
Then they normally use detached recordsets. Open connection and recordset and then detatch it and close the connection. After handling the modifications at the client's end, re-connect to the server and update in batchmode and handle exceptions. This is good because the connections for each recordset do not remain open on the server. Reconnecting also does not take time, because present day application servers maintain connection pool in their Cache.

But the way we use ADO from Harbour code is different and we better do not hold more than one open connection per application.

Regards



G. N. Rao.

Hyderabad, India
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Converting DBFCDX to SQL (ADO)
Posted: Mon May 20, 2013 08:10 AM
nageswaragunupudi wrote:it is far far more easier to handle DBFs than ADO particularly in multiuser environments.


I agree! DBFs are easier and most powerful. But the market pushes for the archaic SQL technology... :-)

EMG
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Converting DBFCDX to SQL (ADO)
Posted: Mon May 20, 2013 08:24 AM

Mr. Nages,

Do you sell TAdoBase or do you plan to incorpórate to FWH?.

Could you please provide more information about it?. It seems very very interesting.

Thank you.

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Converting DBFCDX to SQL (ADO)
Posted: Mon May 20, 2013 02:12 PM
Enrico Maria Giordano wrote:
nageswaragunupudi wrote:it is far far more easier to handle DBFs than ADO particularly in multiuser environments.


I agree! DBFs are easier and most powerful. But the market pushes for the archaic SQL technology... :-)

EMG

I agree with you totally, including the adjective "archaic".

But when tables are really *huge* with lots of concurrent users working round the clock, we are left with no choices. For medium sized databases ADS is still the best providing us the best of both the worlds.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Converting DBFCDX to SQL (ADO)
Posted: Tue Jun 04, 2013 08:00 AM
Dear Mr.Rao,

I do agree with Lucus, it's really interesting.

Regards,
Dutch
lucasdebeltran wrote:Mr. Nages,

Do you sell TAdoBase or do you plan to incorpórate to FWH?.

Could you please provide more information about it?. It seems very very interesting.

Thank you.
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: Converting DBFCDX to SQL (ADO)
Posted: Tue Jun 04, 2013 03:22 PM

Hello,

I am interested too. It would be great to have a TDBF class for ADO or, at least MySQL.

X ailer has those feature included, so with same class and methods they handle whatever database engine.

Thanks a lot!

Continue the discussion