Issue Details (XML | Word | Printable)

Key: CORE-4881
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Adriano dos Santos Fernandes
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Increase maximum string literal length to 64K (bytes) while setting a lower limit (of characters) for multibyte charsets based on their max char. length (UTF-8 literals will be limited to 16383 characters)

Created: 22/Jul/15 03:18 PM   Updated: 04/Aug/15 02:53 PM
Component/s: Engine
Affects Version/s: None
Fix Version/s: 3.0 RC1

QA Status: Done successfully


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Adriano dos Santos Fernandes made changes - 22/Jul/15 03:18 PM
Field Original Value New Value
Assignee Adriano dos Santos Fernandes [ asfernandes ]
Adriano dos Santos Fernandes made changes - 27/Jul/15 01:07 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 RC 1 [ 10584 ]
Resolution Fixed [ 1 ]
Adriano dos Santos Fernandes made changes - 27/Jul/15 01:08 AM
Affects Version/s 3.0 RC 1 [ 10584 ]
Pavel Zotov made changes - 30/Jul/15 05:25 PM
Status Resolved [ 5 ] Resolved [ 5 ]
QA Status No test Done successfully
Pavel Zotov made changes - 30/Jul/15 05:25 PM
Status Resolved [ 5 ] Closed [ 6 ]
Pavel Zotov added a comment - 30/Jul/15 06:07 PM
Can anyone explain me please why following script:

script-1:
######

set names utf8; ----------------------------- [ 1 ]
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;

set planonly;
set sqlda_display on;
select _octets ' . . .literal string containing ONLY ascii characters with total length = 65535 bytes ...' as ascii_only
from rdb$database;

-- produces:
==========

OUTPUT message field count: 1
01: sqltype: 452 TEXT scale: 0 subtype: 0 len: 32767 charset: 1 OCTETS
  : name: CONSTANT alias: ASCII_ONLY
  : table: owner:

And this:

script-2:
######

set names NONE; --------------------------- [ 2 ]
create database 'localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\c4881.fdb' default character set utf8;

// ... the rest is the same as in script-1 ...

-- produces:
==========

OUTPUT message field count: 1
01: sqltype: 452 TEXT scale: 0 subtype: 0 len: 65533 charset: 1 OCTETS
  : name: CONSTANT alias: ASCII_ONLY
  : table: owner:


From where values '32767' and '65533' come ?

1) If connection charset is UTF8 than is is possible to create literals that will use MORE than two bytes for encoding (in practice one may easy to create literals with 3 bpc; I could not create with 4 bytes, but this seems due to my poor windows)
So, value '32767' is wrong, it should be floor( 65535 / 4 ), isn't ?

2) from where 65533 rather than 65535 for second test ?

Adriano dos Santos Fernandes added a comment - 04/Aug/15 02:53 PM
select _octets ' . . .literal string containing ONLY ascii characters with total length = 65535 bytes ...' as ascii_only
from rdb$database;

Produces sqllen = 65533 (not the value you said) because internally it's converted to varchar and that is the max. That will cause a runtime error.