When neither \ nor "" works ...

legionar

New Member
Hi.

We have Progress 91d database and DataDirect 4.1 32-bit Progress SQL92 v9.1D ODBC driver under Windows Vista Ultimate.
Everything works except file-name with hyphen.
I have found some articles about it, but neither \ nor "" works.
Example:
$sql = "select something1, something2 from some-file";
... some\-file
... & "some-file"
... & "some\-file"

Nothing works ... :(
Please, help me, if you can.
 

RealHeavyDude

Well-Known Member
AFAIK you need to do something likes this:

$sql = 'SELECT something1, something2 FROM PUB."some-file";'


HTH, RealHeavyDude.
 

legionar

New Member
No. I said, everything works !
Except hyphen-names ...
I put "PUB" into windows registry for ODBC DefaultSchema. ;)

For example:

$sql = "select something1, something2 from somefile";
$esql= ODBC_Exec($conn, $sql);

is OK.
 

FrancoisL

Member
I assume you are using PHP.

You need to escape both your " characters.

$sql = "select something1, something2 from \"some-file\"";
 

legionar

New Member
I assume you are using PHP.

You need to escape both your " characters.

$sql = "select something1, something2 from \"some-file\"";

No, it doesn't work ... :(
I have tried almost every possible (or even impossible) combination ...
It must be something wrong with that driver.
But, why everything else works ?
 

jkuhns

New Member
Try:
Code:
$sql = "select something1, something2 from [some-file]";
While I think this will work for you, it introduces another question. What's the proper SQL format for a field name with a dash which is also an array? I'm neck deep in hibernate mappings and have not yet run into this situation, but I'm 99% sure it's going to come up.
 

tamhas

ProgressTalk.com Sponsor
Have you tried this in something like SQL Explorer or one of the SQL query tools? Quoting of hyphenated file names works there, so I would start with that to prove out your statement and then check it again in the context of the tool (PHP?) in which you are trying to use it. I've done a ton of this without problems, so either there is something else wrong or the problem relates to using quotes in the context of the tool.

The alternative is to define a view on the table with a non-hyphenated name.
 
Top