Hi Sandeep,

  I think this can be fix be changing the Oracle DB Adapter's code. AFAIK, it is the 
Oracle DB Adapter that does the character escaping (is that the right word??). Why 
don't you look into that and fix it and release it to the community? Thats what I had 
to do for the BLOB and CLOB issue with Oracle.

~Sarav

-----Original Message-----
From: "Sandeep S. Chhikara" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Date: Wed, 23 Jun 2004 11:59:51 -0500
Subject: java escape character save retrieve problem

Hi F. FrayYes you understanding is correct. And code sample is exactly same as you 
have sent. WOrking on your example, after save() method call the database will have 
valueC:\dev\test\myfile.doc  for column FILEPATH.However, in load() method this call 
List hits = FileObjectPeer.doSelect(criteria);
will always return emply list since torque criteria object will generate sql where 
clause as select ......from ... where FILEPATH ='C:\\dev\\test\\myfile.doc'and since 
database contains this value as 'C:\dev\test\myfile.doc' nothing will be ever 
returned.Now if you guys are starting up on this project, i would suggest use"/" as 
path separator and everything will be ok, since this will not need java 
escapecharacter.Please do reply, for suggestion to fix the strange behaviour of torque 
criteria objects.thanksSandeep Chhikara
From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wed, 23 Jun 2004 08:22:16 +0200
Subject: java escape character save retrieve problem
Content-Type: multipart/mixed; boundary="--d6f740d669e2f95"

Good Morning Sandeep!

Don't know if I did understand you right. You say:
Saving a String with slashes works correct, but retrieving such rows
doesn't work?
Please send a code snippet! Would interest me since we have to do this,
too!
Is it something like: 
<example>

void save() {
  FileObject f = new FileObject();
  f.setPath("C:\\dev\\test\\myfile.doc");
  try {
    f.save();
  } catch (Exception e) {
  }
}

FileObject load() {
  Criteria criteria = new Criteria();
  criteria.add(FileObjectPeer.PATH, "C:\\dev\\test\\myfile.doc");
  try {
    FileObject f;
    List hits = FileObjectPeer.doSelect(criteria);
    if (hits.size() == 0) {
      f = null;
    } else {
      f = (FileObject) hits.get(0);
    }
    return f;
  } catch (Exception e) {
    return null;
  }
}

</example>

??? Please send your code!

F. Fray



----- Originalnachricht -----
Von: "Sandeep S. Chhikara" <[EMAIL PROTECTED]>
Datum: Dienstag, 22. Juni 2004 10:53 pm
Betreff: java escape character save retrieve problem

> Good Afternoon Everyone, 
> 
> I am using torque 3.1 and experiencing a strange problem with 
> escape character in dir path.
> Environment:
> jdk1.4
> torque 3.1
> MSSQlServer 2000
> OS: windows 2000 server
> 
> In database table, i have a column to store filePath.
> I read a file path from file which is "SINGLE \" 
> C:\dev\test\myfile.docand since java adds a escape"\" character so 
> in debugging i see this path as " DOUBLE \\"
C:\\dev\\test\\myfile.doc
> but while saving in DB torque saves this correctly,as expected
> "SINGLE \" C:\\dev\\test\\myfile.doc.
>
> When i try to retrieve this data using torque criteria the
> filePath set as  "SINGLE \" C:\dev\test\myfile.doc
> and as discussed earlier java adds escape character torque
> criteria has filePath value " DOUBLE \\" C:\\dev\\test\\myfile.doc.
>
> Now i never get the saved row back, since db value  "SINGLE \"
> C:\dev\test\myfile.doc will never match with
>  DOUBLE \\" C:\\dev\\test\\myfile.doc and hence no row is
> returned back.
>
> The above mentioned example works fine with path as
> C:/dev/test/myfile.doc ie saving and retrieval works.
>
> Please suggest how can i fix this problem, and make torque save
> and retrieve same value.
>
>
> thanks
> Sandeep Chhikara






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to