FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Relations between SQL-table and DBF
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Relations between SQL-table and DBF
Posted: Fri Oct 12, 2012 03:57 PM

Hi,

Is it possible to have relations between a SQL-recordset and a DBF-file?
In my DBF-version of my program I have a list a customers.
I have also an temporary empty - local DBF-file with only 2 field. An ID-record, and a numeric field.
There is a relation betwen the ID of the client, and the field op the temporary file.
If the user double-click one row of the list, I add that ID to the temp-file and the record is selected. N° 1 is displayed in the last column.
He can select more than one record. He can also double-click the same record again, so it's 2 times selected. N° 2 is displayed in the last column.
Now can print labels of the list.
How can I do this in SQL? I can't add a field in the table, because it's possible tha more that one user of the network-program want to print.
That's reason wy I created a local temorary file + relation.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Relations between SQL-table and DBF
Posted: Fri Oct 12, 2012 04:03 PM

Marc

There is nothing wrong mixing Sql with .dbf .. Just for the reasons you mentioned .. I create a lot of reports that use a SQL query, but I create a temporary .dbf and append the recordset from SQL and populate the .dbf for the output. .. then delete the .dbf when I am done.

Don't worry about any formal relations ( set relation to ) between the two formats .. it is not important and not possible.

Rick Lipkin

Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Relations between SQL-table and DBF
Posted: Sun Oct 14, 2012 09:55 AM

Rick,

Reading the SQL-table into DBF takes a couple of seconds when you have a lot of records.
Is it possible to add a dummy field to the table, and put there the number a time that the row is selected BUT don't do an update to the SQL-database, so only in the recordset it is changed. Or do you have a better solution for this problem?
I was maybe thinking to create an additional table in the database an link this table with a join with tha table where I want to select the records, and for the join I link on ID and the user-name, so more than one user can select at hte same time.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Relations between SQL-table and DBF
Posted: Sun Oct 14, 2012 12:50 PM
Hello

MySql wrote:http://dev.mysql.com/doc/refman/5.1/en/create-table.html,
You can use the TEMPORARY keyword when creating a table. A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.) To create temporary tables, you must have the CREATE TEMPORARY TABLES privilege.
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: Relations between SQL-table and DBF
Posted: Sun Oct 14, 2012 02:40 PM

Thanks Daniel,

I will try that.

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite

Continue the discussion