Let's look at how the XBase database(s) work internally to store data first.
In a given XBase database, each database table is stored in a file of the corresponding name. For example, the table USER whould have been stored as USER.dbf.
When you construct an SQL to query data inside USER, you would do something like this:
$dbname = "USER";
$sql = "select USERNAME from $dbname";
And this should work fine.
Now what happens if you have spaces in the filenames, say, "User Names Database.dbf" on windows, which is valid, the SQL query becomes:
$dbname = "User Names Database";
$sql = "select USERNAME from $dbname";
And of cause it will not work, because the SQL string becomes
select USERNAME from User Names Database
which is an invalid SQL statement.
I haven't tried this, but to resolve the long name issue on Windows boxes, you could patch the database names by adding single quotes around it:
$dbname = "User Names Database";
$tblname = "'" . $dbname . "'";
# or $tblname = '"' . $dbname . '"';
$sql = "select USERNAME from $tblname";
And this should work because the new SQL string becomes
select USERNAME from 'User Names Database'
I think this might resolve the long filename issue on Windows machines.
Update:
Ok, I tried my solution, but it didn't work on my Sybase database. It's more of a database implementation issue. **blush**
Try it anyway to see if it works or not. Otherwise the quick solution is to change spaces in the filenames to underscores.
|