FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour tData for SQL
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
tData for SQL
Posted: Wed Jul 02, 2014 03:36 PM

James,

There is a lot of talk here about converting from DBF files to SQL.

As a long time user of tData ( it's in 100% of my code ), what would be the conversion possibilities to have a modified version that would work with SQL ? Maybe that is just "way out there" in ideas, but the thought of changing all that code ... well it's just not appealing at this stage in life ...

I figured you may have given this topic some thought, but I'm also posting it here so it will be dialoged by others who also use tdata.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: tData for SQL
Posted: Wed Jul 02, 2014 04:09 PM

Tim,

Please search in the fórums for datarow class.

Very fast to work with it. :D :D

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: tData for SQL
Posted: Wed Jul 02, 2014 04:33 PM

FWH has TDataBase class for DBFs, which has been improved a lot during few years.

Very soon FWH will have a TRecSet class whish is a wrapper class to ADO RecordSet. Both TRecSet and TDataBase will have the same methods.

Using TRecSet class programmer can use methods like ADO RecordSet class. At the same time he can use methods like TDatabase class. A program written for DBF with TDatabase can be easily ported to TRecSet class.

TDataRow is a class which deals with a single record. The record can be from DBF, AdoRecordSet. Browse Row, etc. Code written using TDataRow is fully portable across different datasources.

Regards



G. N. Rao.

Hyderabad, India
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: tData for SQL
Posted: Wed Jul 02, 2014 05:04 PM
tData is an extension of the tDatabase class. Here is an example of code written using the tData objects:

Code (fw): Select all Collapse
    // Display edit dialog for eAuto account and this company's data
    // Open database
    oDcf := tdata():new(, cPath + "dForce\dfsetu" )
    oDcf:use()
    IF oDcf:reccount( ) = 0
       oDcf:append( )
    ENDIF
    oDcf:goto( 1 )

    // Create dialog
    DEFINE DIALOG oDlg RESOURCE "DFORCE" BRUSH oBrush TRANSPARENT OF oWnd FONT oMFont

    REDEFINE CHECKBOX ldForce ID 116 OF oDlg MESSAGE "Check if you wish to turn on Demand Force processing"  UPDATE
    REDEFINE GET oDcf:dfsnam ID 102 OF oDlg MESSAGE "Enter the shop name" UPDATE
    REDEFINE GET oDcf:dfsadr1 ID 103 OF oDlg MESSAGE "Enter the shop address line 1" UPDATE
    REDEFINE GET oDcf:dfsadr2 ID 104 OF oDlg MESSAGE "Enter the shop address line 2"  UPDATE
    REDEFINE BTNBMP RESOURCE "HROK" ID 121 of oDlg PROMPT "Accept" ;
        ACTION ( oDcf:save( ), oDlg:End( ) ) MESSAGE "Use the values entered above" NOBORDER TRANSPARENT

    // Activate the dialog screen
    ACTIVATE DIALOG oDlg ON INIT oDlg:center(wndmain())

    // Close database and exit
     oDcf:close( )
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: tData for SQL
Posted: Wed Jul 02, 2014 05:08 PM
tData is an extension of the tDatabase class. Here is an example of code written using the tData objects:

Code (fw): Select all Collapse
    // Display edit dialog for eAuto account and this company's data
    // Open database
    oDcf := tdata():new(, cPath + "dForce\dfsetu" )
    oDcf:use()
    IF oDcf:reccount( ) = 0
       oDcf:append( )
    ENDIF
    oDcf:goto( 1 )

    // Create dialog
    DEFINE DIALOG oDlg RESOURCE "DFORCE" BRUSH oBrush TRANSPARENT OF oWnd FONT oMFont

    REDEFINE CHECKBOX ldForce ID 116 OF oDlg MESSAGE "Check if you wish to turn on Demand Force processing"  UPDATE
    REDEFINE GET oDcf:dfsnam ID 102 OF oDlg MESSAGE "Enter the shop name" UPDATE
    REDEFINE GET oDcf:dfsadr1 ID 103 OF oDlg MESSAGE "Enter the shop address line 1" UPDATE
    REDEFINE GET oDcf:dfsadr2 ID 104 OF oDlg MESSAGE "Enter the shop address line 2"  UPDATE
    REDEFINE BTNBMP RESOURCE "HROK" ID 121 of oDlg PROMPT "Accept" ;
        ACTION ( oDcf:save( ), oDlg:End( ) ) MESSAGE "Use the values entered above" NOBORDER TRANSPARENT

    // Activate the dialog screen
    ACTIVATE DIALOG oDlg ON INIT oDlg:center(wndmain())

    // Close database and exit
       oDcf:close( )


Of course, filters and scopes are fully supported, saves, etc. Browses are incredibly easy to setup.

I have 208 .prg files in this application, some with up to 7500 lines of code. There are over 100 dbf files. The size of a re-write to SQL has stopped me from progressing. Also, I would need to build a utility that creates the new SQL database, with all those tables, and imports all of the existing data ( in some cases, close to 30 years of data for a small business ).

I think it's important to move forward, but I'm trying to evaluate just how massive this project might become.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: tData for SQL
Posted: Wed Jul 02, 2014 06:37 PM
#1 Yes. Originally TData was an extension of TDatabase. Now TDatabase is extended a lot by itself. It is not my intention is to compare or advise any change. I rather advise *not* to change. Any change is a big effort. I just wanted to place on record that now TDatabase is a very enriched class.

#2. Keeping portability in view we are going to introduce TRecSet class. With very few changes (mostly while opening the table) TDatabase code should work with TRecSet also. If there are going to be users it will be included in Sept release. It is not really a new work. Refurbishing the classes I have been personally using for years in my real life applications. The TRecset class transparently handles differences between harbour/xharbour and those minor but important differences between different SQL DBMSs.

#3. FWH already provides many ado functions for exporting DBFs to SQL DBMSs. The job of migrating tables is very easy. Example: FW_AdoImportFromDBF(...).

We purposefully designed XBrowse to help portability. With the same intention we added and integrated TDataRow class. Using both together we can write a table maintenance program in a very few steps that is fully portable between dbf, ado, tdatabase like objects, tdolphin, etc.

I personally advise you plan to move ahead. FWH provides the tools for you.
I think it's important to move forward, but I'm trying to evaluate just how massive this project might become.

There is no doubt it requires good effort. But it is definitely not going to be as massive as you might be thinking.
Regards



G. N. Rao.

Hyderabad, India
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: tData for SQL
Posted: Wed Jul 02, 2014 10:52 PM

I have my entire program now fully built, and running, with FWH / Harbour / and Visual Studio 2013. The next logical step is SQL and some significant code refinements. Some of the newer capabilities are in classes while some of the older ones are still function sets. More will be converted to classes.

The code set spans over 30 years, starting from dbase II code running under CP/M. It has grown, been modified, enhanced to Windows, and embraced many new capabilities over the years.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: tData for SQL
Posted: Mon Jul 07, 2014 05:37 PM
Tim,

As a long time user of tData ( it's in 100% of my code ), what would be the conversion possibilities to have a modified version that would work with SQL ? Maybe that is just "way out there" in ideas, but the thought of changing all that code ... well it's just not appealing at this stage in life ...

I figured you may have given this topic some thought, but I'm also posting it here so it will be dialoged by others who also use tdata
.

Actually, I gave it some thought back in 2008 and I already wrote a recordset class that emulates TData. There wasn't much interest at the time so I didn't pursue it further. I will dig it up, review it, and get back to you.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: tData for SQL
Posted: Mon Jul 07, 2014 06:10 PM

James,

A lot has changed in 6 years, and likely there is more interest now. Also, newer FWH capabilities are focusing on that now.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Guest
Posts: 0
Joined: unknown
Re: tData for SQL
Posted: Mon Jul 07, 2014 06:17 PM

Tim

Rao has done some nice work in creating FW wrappers for many for the routine Sql Ado methods. For me ( when I was learning ado ) it was useful in understanding the basic methods and what they did so I had a clearer idea what was possible and the method definitions.

Here is the MSDN link to the Ado Class and Methods used with your recordsets.

http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Rick Lipkin

Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: tData for SQL
Posted: Tue Jul 08, 2014 12:55 AM

Thanks Rick,

I've got one project to finish up ( this week hopefully ) and then I plan to dive into this aggressively. I've also retained your notes from before.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: tData for SQL
Posted: Tue Jul 08, 2014 06:29 AM

Hello Tim,

have you ever considered to switch to remote desktop and keep the dbf databases.
You can tweak remote desktop using polices and get this way the security and flexibility you need and best
you need only one program to serve all the operating systems.

We have now a custom version of a remote client for our purpose. We do not use VPN anymore. This way connection is much faster and easier.

This is from an email exchange with the programmer of the remote client:

As far as I know the only way to avoid the VPN security prompt in Android might be (I've never able to get this to work) to set up an "Always-On VPN" connection (see "vpn.png" attachment). Only L2TP or IPSec VPNs are supported (not PPTP).
Even with custom VPN applications, Android will always prompt (according to this) if the application is trusted.
RDP protocol uses TLS internally, so strictly speaking, it provides security level comparable with IPSec VPN and higher than PPTP. By default, remote client accepts any server certificate when it's establishing a connection, and relies on username/password authentication mechanism only, but it would be possible to add server certificate verification capability to remote client for additional security, and avoid having to use VPN completely.

To use RDP without VPN, your RDP server will need to be accessible via Internet. RDP uses TCP port 3389, so you will need to open that port on the firewall, (or set up a different port and redirect it to server's port 3389). In remote client you will need, of course, to specify the public IP address or host name, and if the port number is different than 3389, you can add it too, separated by colon (':'), such as: "1.2.3.4:5678" (where 1.2.3.4 is the IP address, and 5678 is the port number).

It's now possible to:
a) specify screen orientation (system, portrait, or landscape) in "custom resolution" settings dialog
b) disable the menu icon (the orange gear icon) from being displayed when connection is active
c) disable zoom
Once connection is configured, you can add a "widget" to Android launcher screen, which will allow you to activate a specific connection directly.

Best regards,
Otto

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: tData for SQL
Posted: Tue Jul 08, 2014 07:07 AM

Dear Otto,

whats the name of that Android app ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
Re: tData for SQL
Posted: Tue Jul 08, 2014 07:32 AM

Hello Antonio,
this version is not distributed using "Play" store.
If there is interest I can talk with the programmer.
Best regards,
Otto

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: tData for SQL
Posted: Tue Jul 08, 2014 08:32 AM

Otto,

Is there a web site where to review it ?

I am sure others will find it quite interesting too

regards, saludos

Antonio Linares
www.fivetechsoft.com