This is a migrated thread and some comments may be shown as answers.

Trimming firebird views' char fields, best practice needed!

1 Answer 41 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter Sari
Top achievements
Rank 1
Peter Sari asked on 06 Nov 2013, 11:55 AM
Hi!

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,

Peter

1 Answer, 1 is accepted

Sort by
0
Ady
Telerik team
answered on 11 Nov 2013, 08:57 AM
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.

Regards,
Ady
Telerik
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!
Tags
Data Access Free Edition
Asked by
Peter Sari
Top achievements
Rank 1
Answers by
Ady
Telerik team
Share this question
or