Converting DBFCDX to SQL (ADO)

Re: Converting DBFCDX to SQL (ADO)

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Converting DBFCDX to SQL (ADO)

Postby nageswaragunupudi » Mon May 20, 2013 1: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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Converting DBFCDX to SQL (ADO)

Postby Enrico Maria Giordano » Mon May 20, 2013 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Converting DBFCDX to SQL (ADO)

Postby lucasdebeltran » Mon May 20, 2013 8: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.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: Converting DBFCDX to SQL (ADO)

Postby nageswaragunupudi » Mon May 20, 2013 2: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
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Converting DBFCDX to SQL (ADO)

Postby dutch » Tue Jun 04, 2013 8: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 19.01 / 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)
User avatar
dutch
 
Posts: 1554
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Converting DBFCDX to SQL (ADO)

Postby elvira » Tue Jun 04, 2013 3: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!
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 28 guests