LPM: Off-topic: SQL question
Rich Bowen
rbowen at rcbowen.com
Fri Jan 14 13:15:12 CST 2000
David Hempy wrote:
>
> Okay, this has nothing to do with perl, but you guys are just so darned
> helpful...
>
> In my Visual FoxPro (VFP) table, I've got a field of type memo. A memo
> field is an unlimited length character field. I regularly store several
> kilobytes of data in each field from VFP.
>
> I have been unable to store more than 255 bytes from perl, via Win32::ODBC.
> I'm quite certain the problem is from VFP's ODBC driver, not in perl nor
> the ODBC module. This is the error I get:
>
> [219] [1] "[Microsoft][ODBC Visual FoxPro Driver]Command contains
> unrecognized phrase/keyword." at d:/edit-www/cgi-ket/scout.pl line 587.
>
> For the command:
>
> $cmd = qq {update release set rtf_bytes=$rtf_bytes, headline=
> '$headline', html_body='$html_body' where releaseid='$releaseid' };
>
> This happens when $html_body has 256 characters, but not if it has 255 or
> less. Also of note, it gives the same error if there are any \n in the
> string, even for short strings. I've tried escaping them in different
> ways, but can ignore that problem in this case by (gasp) removing all \n in
> the string.
>
> I've tackled a two ten-pound SQL books looking for a way to specify the max
> length of a field, info on varchar fields, or documentation of a max string
> length, but I haven't found anything yet. If anyone has a quick answer,
> I'm all ears.
If you're using DBI, you can do
$dbh->{'LongReadLen'} = 6000;
or similar, which sets the max on field length higher than it is by
default. I remember seeing this problem when I first switched from
Win32::ODBC to DBI, and the above made it go away. But I don't recall
ever seeing this with Win32::ODBC. But I do recall, from a discussion on
clpm that ensued when I asked this very question, that it had something
to do with ODBC itself, and was not specific to Perl, DBI, Win32::ODBC,
or the specific database. Perhaps there is some similar function on
Win32::ODBC? I don't remember.
Rich
--
http://www.ApacheUnleashed.com/
Lexington Perl Mongers - http://lexington.pm.org/
PGP Key - http://www.rcbowen.com/pgp.txt
More information about the Lexington-pm
mailing list