Thanks for the tip on handling memos. I always thought, "If I could just append to the end of the existing string..." but never figured out how to do it. I'll give your method a shot.


On Jul 21, 2009, at 2:04 PM, Matt Neimeyer wrote:

What I did to handle memos... and it's a HACK... was to create a
function DoMemo that took as arguments the table, the primary key
field of the table, the value of said pk, the field to update, and the

Take the first 200 characters of the string.
Replace all newlines in that substring with "+CHR(13)+" (Or CHR(13)+CHR(10)?) Then do something like: UPDATE table SET field=First200 WHERE pk=pkvalue

Then take the next 200 characters of the string.
Replace all newlines as above
Do something like: UPDATE table SET field=ALLTRIM(field)+Next200 WHERE

Repeat until you've "consumed" the entire string. This works because
you never put in more that 250 odd characters at a time. It can still
fail though if you have enough newlines to push your 200 characters up
over the 250 odd character limit.

It DOES work if you use RECNO() as the pk field and the appropriate
recno() that you would get if you did something like SELECT recno() AS
myrecno,* FROM sometable (I use the myrecno because otherwise you get
some weird exp_1 field name)

It just popped into my head... I wonder if something like this would work...

UPDATE sometable SET a=1,a=a+1,a=a+1,a=a+1 WHERE x=y

You might be able to limit the total number of calls to the database
that way... If I wasn't in the process of migrating to MySQL I might
give it a whirl... :)

Hope this helps whatever you decide to do.

On Tue, Jul 21, 2009 at 8:27 AM, Floyd Resler<> wrote:
Thanks for the information. I'll look into using ODBTP. I noticed you mentioned the problem with memos. I currently have that problem with
the set up we're using and it is a pain!


On Jul 20, 2009, at 3:22 PM, Matt Neimeyer wrote:

We currently use the Easysoft ODBC Bridge to connect to a remote FoxPro
database.  The problem is that the bridge, after a while, starts
consuming a
ton of system resources and we have to reboot the machine. Afterwards,
can take upwards to two hours before everything is running quickly again. We need another solution. Does anyone know of a any other way to connect to a remote FoxPro database (or any ODBC source that isn't a database

We've had a LOT a luck using ODBTP. Which can be found at

Here's the rough outline...

1. Install Visual FoxPro odbc driver (or whatever drivers you want) on
a Windows machine.
2. Install the ODBTP Server on the windows machine
3. Install a PHP module in your php. (Common ones included in the
4. Once you connect the functions are ALMOST exactly the same in usage
as the mysql_xyz functions.

A couple gotchas:

1. If you need to compile the PHP ODBTP module from source on x64 (OS
X Leopard at least) it can be a pain.
2. The VFP 6.0 ODBC driver (not sure about higher versions) does not
allow more than 250 odd characters to be inserted at a single time so
memo's can be a PAIN.
3. It does require a port be opened on the Windows machine's
firewall... (Uses TCP/IP for communication)
4. By default the ODBTP server can use up to 32 threads. The VFP ODBC
driver is by nature single threaded. We've never had a problem with
that directly but I assume it is what causes threads to slowly hang
and disappear... eventually a message comes up "Unable to create
thread". At that point you simply need to restart the ODBTP service in the Windows Services Control Panel. The bigger the tables and the more
heavily used it is the more often this will happen.

Other than that... Works like a charm. Looking forward, once you bite
the bullet and convert to MySQL (at least for us) you can almost
change odbtp_ to mysql_ and be up and running. (Assuming you limit
yourself to "pure" SQL and not invoke VFP functions.)


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to