The issue here has nothing to do with the length of the filename, it has to do with the spaces in it. The issue is delimited identifiers, also called quoted identifiers. It is unrelated to quoting of *values* which is the concern of placeholders and $dbh->quote(). It has to do with allowing non-standard names for tables and columns inside delimiters. Spaces in table names are nonstandard. The SQL standard specifies double-quote " as the delimiter but MySQL uses backticks as well as double-quote, Access uses square brackets, some RDBMSs use single quotes.

DBD::XBase does not support delimited identifiers at all. This is usually not a problem because it also doesn't check to see if the table name is standard SQL, but it won't know how to parse table names with spaces in them.

But since a table name is just a file name in DBD::XBase, why not just write a script to rename the files replacing spaces with underscores, run it on *.dbf, and away you go.

Or, if you really don't want to rename your files, you could patch XBase.pm with this single line at linenum 43 of version 2.40:

$filename =~ s/_/ /g;

Replacing the underscore with any character you'd like and just use that character instead of a space in your SQL e.g. "SELECT * FROM foo_bar_baz.dbf" would find file "foo bar baz.dbf".


In reply to Re: Long file names in .dbf databases by jZed
in thread Long file names in .dbf databases by talwyn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.