Trimming firebird views' char fields, best practice needed!

Thread is closed for posting
2 posts, 0 answers
  1. Peter Sari
    Peter Sari avatar
    3 posts
    Member since:
    Apr 2010

    Posted 06 Nov 2013 Link to this post


    We're using OpenAccess ORM with Firebird, and we have a problem:

    We're using firebird views as entities in the ORM, and we also use firebird system tables to get field information (size, default value etc.) about the table fields which views use (to have some basic validation in our app).

    A lot of our old tables use char type fileds wich contain ending spaces. We'd like to trim these. 

    At first we tried to trim the fields in the views' sql, it works fine, but at the same time the trimmed fields suddenly disappear from firebird system tables, so we cannot get table field information anymore, so we dropped the solution of trimming in views' code. We cannot modify the base tables either. Annoying.

    So we're looking forward the best and most elegant solution in our data access layer, in application code (where a sort of other problems can appear: change of context state because of trimming, etc).

    Every idea is appreciated.
    Thanks in advance,

  2. Ady
    Ady avatar
    589 posts

    Posted 11 Nov 2013 Link to this post

    Hello Peter,

     If I understand you right, you want to trim spaces at the end of certain  fields' values.
    You would need to add a transient field that would hold the trimmed value and then implement the IInstanceCallback interface. You can trim the value in the 'PostLoad' method implementation and set the value of the transient field.

    Hope this helps. Do get back in case you need further assistance.

    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
Back to Top