tDatabase- AdsSetAof()-RESUELTO

tDatabase- AdsSetAof()-RESUELTO

Postby D.Fernandez » Thu Nov 16, 2017 8:49 pm

Hola amigos.
Existe la posibilidad de agregar AdsSetAof() a tDatabase?
Gracias.

Ruben Dario Fernandez.

Mi hijo lo relvió
En tData debe incluirse
#include "ads.ch

method setAOF(cFilter) inline (::cAlias)->(AdsSetAOF(cFilter))
method clearAOF inline (::cAlias)->(AdsClearAOF())

Gracias. Saludos
Ruben Dario Fernández
Last edited by D.Fernandez on Sat Nov 18, 2017 1:26 am, edited 1 time in total.
Dario Fernandez
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 463
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay

Re: tDatabase- AdsSetAof()

Postby James Bott » Thu Nov 16, 2017 9:59 pm

Ruben,

Adding ADS functions to TDatabase is not the best way to handle this.

OOP principles are that you should create a separate class to handle a separate database type. Thus you could have an array class that works using the same methods as a DBF database class. You can then plug in either class to a program without making any changes to program code. Similarly you could have a CSV class, an XML, or an SQL class, that also use the same methods.

What you don't want to do is to try to combine them all into the same class with a lot of IF/THEN and DO/CASEs. Then you are just falling back to procedural code and this gets very complex, messy to work on, and prone to errors. Further, whenever you try to add or fix something you risk breaking more than just the database type that you are working on. Thus, you would be forced to have complex test routines that tested all of the different data sources whenever you made the smallest change to the class code--or otherwise you risk all kinds of errors.

In the case of ADS, it already uses a lot of the same code that DBFs use, but it adds a number of features that standard DBF code does not have. Therefore, for this situation, the best approach is to subclass from TDatabase and make a new class for ADS. In the new TADS class you can add all the functions that are unique to TADS as methods. This way you do not risk breaking any of the DBF class code, and you do not have to recreate it in the new class.

For an array class, subclassing TDatabase would not be possible since arrays don't use any of the same database syntax and/or functions. So an array class would need to be written from scratch. It would contain the same methods as TDatabase but they would act on an array.

I hope that was clear, if not let me know.

Regards,
James
Last edited by James Bott on Thu Nov 16, 2017 10:05 pm, edited 1 time in total.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: tDatabase- AdsSetAof()

Postby D.Fernandez » Thu Nov 16, 2017 10:03 pm

Thank you James. Very clear.

Regards
Ruben Dario Fernández
Dario Fernandez
FWH 24.09, Harbour, MVS2022 Community, BCC, MySql & MariaDB, Dbf/Cdx VSCode.
Maldonado - Uruguay
D.Fernandez
 
Posts: 463
Joined: Wed Jul 31, 2013 1:14 pm
Location: Maldonado - Uruguay


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 53 guests