Menu

#105 trim function not supported by firebird 1.5

7.2.0-alfa
closed
None
2016-02-12
2014-10-26
No

7.1.4-stable

Firebird-1.5 protocol and the same firebird server. I have got an error on the simple query "select * from u1_case" because TRIM function is used but not supported by firebird 1.5.

The SQL: SELECT a.RDB
$RELATION_NAME, a.RDB$FIELD_NAME, a.RDB$FIELD_POSITION, a.RDB
$NULL_FLAG, a.RDB$DEFAULT_VALUE, b. RDB$FIELD_LENGTH, b.RDB
$FIELD_SCALE, c.RDB$TYPE_NAME, b.RDB$FIELD_TYPE, b.RDB
$FIELD_SUB_TYPE, b.RDB$DESCRIPTION, b.RDB$CHARACTER_LENGTH,
b.RDB$FIELD_PRECISION, a.RDB$DEFAULT_SOURCE, b.RDB
$DEFAULT_SOURCE as RDB$DEFAULT_SOURCE_DOMAIN,b.RDB
$COMPUTED_SOURCE as RDB$COMPUTED_SOURCE , b.RDB
$CHARACTER_SET_ID FROM RDB$RELATION_FIELDS a JOIN RDB$FIELDS b
ON (b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE) LEFT JOIN RDB$TYPES c
ON (b.RDB$FIELD_TYPE = c.RDB$TYPE and c.RDB$FIELD_NAME = 'RDB
$FIELD_TYPE') WHERE 1=1 and trim(a.RDB$RELATION_NAME) = 'U1_CASE'
ORDER BY a.RDB$RELATION_NAME, a.RDB$FIELD_POSITION;

Discussion

  • EgonHugeist

    EgonHugeist - 2014-10-26

    Hope i got it: R3431 \testing-7.2 (SVN)

    Added a version determination and replaced 'trim' by deprecated 'rtrim' see http://www.firebirdsql.org/refdocs/langrefupd25-udf-rtrim.html

    hope this fix works??

    Michael

     
  • CenturyBreak

    CenturyBreak - 2014-11-01

    Thank you, Michael! Yes, it works! But function rtrim needs to be declared at firebird server. This creates new problems, because my application collects data from a lot of servers...

     

    Last edit: CenturyBreak 2014-11-01
  • EgonHugeist

    EgonHugeist - 2014-11-01

    What does it mean declared on the server? Thought FireBird < 2.0 have the function by default? See my link above.

    Note: I also added a version check -> FB >= 2.0 := TRIM() versus FB < 2.0 := RTRIM();

    See commit log of R3431.

    So i start from the premisse it should match all FB 1-2 series, am i wrong?

    Michael

     
  • CenturyBreak

    CenturyBreak - 2014-11-02

    I mean that function Rtrim exists at ib_udf.dll, this file is located in UDF directory by default, but database does not know about Rtrim until you execute script

    DECLARE EXTERNAL FUNCTION rtrim
    CSTRING(255)
    RETURNS CSTRING(255) FREE_IT
    ENTRY_POINT 'IB_UDF_rtrim' MODULE_NAME 'ib_udf'

     
  • EgonHugeist

    EgonHugeist - 2014-11-05

    Lorb's i was starting from the premisse this function is a build in syntax.

    Note:
    We did broke with the old "Like" syntax because of:
    Table_AAA and Table_A did match same result. Do you know how i can determine if this function persists on Connection start? If nothing found i could execute your proposed DECLARE ...

    Michael

     
  • EgonHugeist

    EgonHugeist - 2014-11-18

    May i ask if it would work if we simply do NOT use Trim or RTRIM?

     
  • Tsutomu Hayashi

    Tsutomu Hayashi - 2014-12-31

    Because RTRIM/LTRIM were not internal function on Firebird1.5/1.0, then you must not use these functions in source code to access system tables.

     
  • EgonHugeist

    EgonHugeist - 2015-12-20

    Jan any progress in this domain?

     
  • EgonHugeist

    EgonHugeist - 2016-02-12
    • status: open --> closed
    • assigned_to: EgonHugeist
    • Milestone: Unknown --> 7.2.0-alfa
     
  • EgonHugeist

    EgonHugeist - 2016-02-12

    Resolved by strict escape-pattern and version checks. Trim won't be used any more for Interbase and FB < V2

     

Log in to post a comment.