Solved

VFP9 & Remote MySQL Backup to Local

Posted on 2010-11-27
4
548 Views
Last Modified: 2012-05-10
Hi all. I have an FP application that makes use of a MySQL db that resides on a remote server.

Locally, I have MySQL installed on Windows and from time to time I use a third-party program to copy all the MySQL tables from the remote server to my local windows installation. This works well but has several manual steps and cannot be run unattended.

What I would like to do is accomplish the same thing, but within my FP app. But I'm not sure where to begin.

Since I can run queries on the remote MySQL db and the local MySQL db, I'm assuming there must be a way to determine what tables exist along with their structure, and recreate those tables locally. And I guess the data as well?

Like I said I'm unsure where to begin, so your help would be greatly appreciated.




0
Comment
Question by:formadmirer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 42

Accepted Solution

by:
pcelba earned 350 total points
ID: 34222278
If you are able to connect to the MySQL server via SQLCONNECT() or SQLSTRINGCONNECT() then you may simply obtain a list of all MySQL tables:

SQLTABLES(lnSqlHandle, "TABLE", "cTables")

Columns for certain table are also easy to populate:

SQLCOLUMNS(lnSqlHandle, "TableName", "NATIVE", "cColumns")

Some code examples are e.g. here:
http://msdn.microsoft.com/en-us/library/f3c5e4wf(VS.80).aspx
http://msdn.microsoft.com/en-us/library/wfktfyx0(VS.80).aspx


More ways of MySQL data handling from VFP are described in the following book which I highly recommend:
http://www.hentzenwerke.com/catalog/mysqlvfp.htm
0
 
LVL 29

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 150 total points
ID: 34222285
How about using a tool like MySQL dump?

http://dev.mysql.com/doc/refman/4.1/en/mysqldump.html

Otherwise, your plan could be done, there is SHOW TABLES to list all tables and SHOW CREATE TABLE will give a create a CREATE TABLE statement you'd need to create a table locally as it's defined remotely.

Nevertheless perhaps first have a read of mysqldump before reinventing the wheel.

Also, if you actually need database replication to have your local database up to date all the time instead of copying the database from time to time, then have a read on replication here: http://dev.mysql.com/doc/refman/5.0/en/replication.html

Bye, Olaf.
0
 

Author Comment

by:formadmirer
ID: 34222504
Thx for the info. I plan to work some with the suggestions from both later on today and see how it goes.

And thanks for the book link. I had no idea a book existed specifically for using MySQL with VFP. I'm currently looking for the best price online and definitely plan on getting this.
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 34223102
Virtually anything can be automated unless it does not involved a human decision. If a user is clicking or typing it can be automated. If he is thinking, it might be automated. :-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
A look at what happened in the Verizon cloud breach.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question