Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Special characters' encoding...
Wed, Apr 21 2010 7:38 AMPermanent Link

durumdara

Hi!

In DBISAM I can use #nnn to encode a special character.

In other DataBases, like PG, uses //nnn, or same thing.

How to encode TAB (chr(9)), CRLF, and other characters (like quotes ", ') in EDB?

Thanks for your help:
  dd
Wed, Apr 21 2010 1:54 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< In DBISAM I can use #nnn to encode a special character. >>

ElevateDB is the same:

http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=String_Types

--
Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 26 2010 6:18 AMPermanent Link

durumdara

<< "Tim Young [Elevate Software]" wrote:
In DBISAM I can use #nnn to encode a special character.
ElevateDB is the same:>>

Dear Tim!

What I don't understand that EDBManager is do not uses #nnn for CRLF and this causing that insert/mod SQLs are splitted by more lines, break the indentation...

So it would be better if EDBManager use #nnn for all characters that is under #032.

Thanks:
   dd
Mon, Apr 26 2010 12:02 PMPermanent Link

A.L. Neelen

Hi Tim,

>> http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=String_Types

This section states "The maximum length is 512 characters.".

However, appendix B states "The maximum length of a VARCHAR/CHAR columns is 1024 characters.". And this statement is correct, because I have a 1024 VARCHAR field in my database.

Best regards,
Fons
Mon, Apr 26 2010 7:02 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< What I don't understand that EDBManager is do not uses #nnn for CRLF and
this causing that insert/mod SQLs are splitted by more lines, break the
indentation... >>

ElevateDB can handle parsing SQL statements and scripts that contain string
literals with embedded CRLF characters, therefore it is perfectly valid for
the ElevateDB Manager to do that.

Perhaps I'm not understanding what you're asking also.  Could you give me an
example of what is causing you a problem ?

--
Tim Young
Elevate Software
www.elevatesoft.com
Tue, Apr 27 2010 9:52 AMPermanent Link

durumdara

"Tim Young [Elevate Software]" wrote:


<< What I don't understand that EDBManager is do not uses #nnn for CRLF and
this causing that insert/mod SQLs are splitted by more lines, break the
indentation...

ElevateDB can handle parsing SQL statements and scripts that contain string
literals with embedded CRLF characters, therefore it is perfectly valid for
the ElevateDB Manager to do that.

Perhaps I'm not understanding what you're asking also.  Could you give me an
example of what is causing you a problem ?>>

The problem that I have copy the SQL to another editors, may the indentation add plus characters.

Python example (the python is indentation-dependent):

print """apple
banana"""

= "apple\nbanana"

def a():
   print """apple
   banana"""

= "apple\n    banana"

So when we use SQL to set CLOB from string, and CRLF-s are real CRLF-s, we must check all indentation to not provide extra space into the field.

SET CLOBFIELD = "apple
banana"

= "apple\nbanana"

   SET CLOBFIELD = "apple
   banana"

= "apple\n    banana"

It would be better:

   SET CLOBFIELD = "apple"#13#10"banana"

And if we use manager's generated SQLs, and use us indentation, may we corrupt the inserted data...

Do you understand this example?

Many times we want to make CLOBs (for message table) from TRIGGERS.


Thanks:
  dd
Tue, Apr 27 2010 12:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< So when we use SQL to set CLOB from string, and CRLF-s are real CRLF-s,
we must check all indentation to not provide extra space into the field. >>

Yes, that is correct.

<< It would be better:

  SET CLOBFIELD = "apple"#13#10"banana" >>

Then you can certainly use that method, if you like.  ElevateDB won't stop
you.

<< And if we use manager's generated SQLs, and use us indentation, may we
corrupt the inserted data... >>

ElevateDB is not responsible for generating SQL for consumption by other
databases, and the SQL that it generates is correct for its own consumption.
If you need to modify the CRLF pairs for use with other databases, then you
can very easily do a string search/replace for all CRLF pairs and replace
them with #13+#10.   For example, in a trigger you could use this:

CREATE TRIGGER "TestCRLF" AFTER INSERT ON "biolife"
BEGIN
  EXECUTE IMMEDIATE 'INSERT INTO LogTable VALUES
(CURRENT_TIMESTAMP(),''INSERT'','+
QUOTEDSTR(REPLACE(#13+#10 WITH '+#13+#10+' IN NEWROW.Notes))+')';
END

You could, optionally, replace the CRLF pairs with '/n' or whatever value
you need for the log table.

--
Tim Young
Elevate Software
www.elevatesoft.com
Image