1. Luca Arena
  2. PowerBuilder
  3. Thursday, 31 January 2019 15:54 PM UTC

Hi all.

I have a problem regarding the escaping of backslash characters with SQL Anywhere dbs. I experience the problem inside a PB Datawindow, but it's merely a db problem, so I will describe it in terms of pure SQL.

Suppose I create a dummy table such as:

CREATE TABLE dummy (filepath char(50));

Then I do the following insert:

INSERT INTO dummy VALUES ('\\theserver\newfolder\thepath');

Well, if I then do a SELECT * FROM dummy I get:

\theserverewfolder\thepath

That is because the \\ and \n have been escaped and trasformed to single backslash (\\) and nothing (\n). Luckily the \t has not been escaped (who knows why?).

If I do the same with a SQL Server database all works ok (no escaping). With MySQL there's an option (NO_BACKSLASH_ESCAPES) that can be sent at connection time to avoid this behaviour.

What about SQL Anywhere? Do you know a way to avoid this?

Thank you much,
Luca

Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 31 January 2019 16:29 PM UTC
  2. PowerBuilder
  3. # 1

I had that issue with my WizSource source control system. What I did was replace the back slashes with forward slashes. Then after selecting the value I change it back.

The PowerBuilder IDE faces the same issue storing workspace properties in the registry. Their solution was to change the back slash to a dollar sign.

 

Comment
  1. Luca Arena
  2. Thursday, 31 January 2019 22:43 PM UTC
Thank you much for your answer, Roland. I also thought about substituting the \ character with something else... but I'd like a simpler, database-configuration solution (also because I have quite a bit of those path fields around in my datawindows). Hope there's such a solution for SQL Anywhere, since other dbs do have one.
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 5 February 2019 05:14 AM UTC
  2. PowerBuilder
  3. # 2

Maybe you could add a trigger to the database that when it reads a string with a backslash it encases the string in single or double quotes.

Another trigger would remove those quotes when you retrieve your data,

 

Olan

Comment
There are no comments made yet.
Chris Keating Accepted Answer Pending Moderation
  1. Tuesday, 5 February 2019 16:20 PM UTC
  2. PowerBuilder
  3. # 3

This is a documented behaviour for Escape Sequences.  This reference also explains why \n is stripped while \t is not.

Comment
There are no comments made yet.
Jeff Wayt Accepted Answer Pending Moderation
  1. Friday, 1 May 2020 11:13 AM UTC
  2. PowerBuilder
  3. # 4

I have to store and search filenames on \\server\folder. As is, it eats one backslash, so three times' a charm: \\\

Comment
There are no comments made yet.
Brad Mettee Accepted Answer Pending Moderation
  1. Friday, 1 May 2020 15:19 PM UTC
  2. PowerBuilder
  3. # 5

Try this: (it worked in both ASA 8 & 17 databases)

To disable: 
set temporary option ESCAPE_CHARACTER='Off';

To enable:
set temporary option ESCAPE_CHARACTER='On';

 

Although docs say it's not meant to be changed, there doesn't appear to be any blocks in the database to prevent it being used.

 

HTH

 

edit: removed Public identifier. 

This change *should* apply only to the current connection, but docs are a bit fuzzy on whether or not that's correct.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.