Relations between SQL-table and DBF

Relations between SQL-table and DBF

Postby Marc Vanzegbroeck » Fri Oct 12, 2012 3: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Relations between SQL-table and DBF

Postby Rick Lipkin » Fri Oct 12, 2012 4: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Relations between SQL-table and DBF

Postby Marc Vanzegbroeck » Sun Oct 14, 2012 9: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: Relations between SQL-table and DBF

Postby Daniel Garcia-Gil » 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.
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Relations between SQL-table and DBF

Postby Marc Vanzegbroeck » Sun Oct 14, 2012 2:40 pm

Thanks Daniel,

I will try that.
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

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