Subject | Re: very stupid error wtih firebird jdbc driver |
---|---|
Author | fred.vlietstra |
Post date | 2009-02-18T07:55:15Z |
Hello Mark,
The trim option works fine. Thank you
--- In Firebird-Java@yahoogroups.com, "Fred Vlietstra"
<fred.vlietstra@...> wrote:
The trim option works fine. Thank you
--- In Firebird-Java@yahoogroups.com, "Fred Vlietstra"
<fred.vlietstra@...> wrote:
>kludge.
> Hello Mark,
>
>
>
> You are right but this is an existing database I cannot change the
> datamodel.
>
>
>
> I shall try your solution. The solution I made is a really a
>Java@yahoogroups.com]
>
>
>
>
> Fred
>
> _____
>
> Van: Firebird-Java@yahoogroups.com [mailto:Firebird-
> Namens Mark Rotteveeljdbc
> Verzonden: dinsdag 17 februari 2009 18:08
> Aan: Firebird-Java@yahoogroups.com
> Onderwerp: Re: [Firebird-Java] Re: very stupid error wtih firebird
> drivercolumn
>
>
>
> Why are you using a CHAR or VARCHAR and not an INTEGER as the
> type (as it looks like you are storing a numeric value), and why isthe
> contents of that column left-padded with spaces?not a
>
> My advise: change your datamodel and use INTEGER as a datatype and
> CHAR/VARCHAR, and otherwise use UPDATE <table> SET <columnname> == ? in
> TRIM(<columnname>) to remove the padding.
>
> If you can't you might want to consider using TRIM(<columnname>)
> your query (although then you will need to use a function-index).spaces.
>
> Mark
>
> PS Your solution below may work, but it is kind of a kludge.
>
> fred.vlietstra wrote:
> > I have solved the problem.
> >
> > You must provide the field with trailing spaces.
> >
> > example I will get the "lidnr" 100 the field must have trailing
> > " 100".gmx.net>
> > So I must add the follwing shit to my class :
> >
> > int len = lidNr.length();
> > String id = null;
> > switch (len)
> > {
> > case 1: id = " " + lidNr;
> > break;
> > case 2: id = " " + lidNr;
> > break;
> > case 3: id = " " + lidNr;
> > break;
> > case 4: id = " " + lidNr;
> > break;
> > case 5: id = " " + lidNr;
> > break;
> > case 6: id = " " + lidNr;
> > break;
> > case 7: id = " " + lidNr;
> > break;
> > case 8: id = " " + lidNr;
> > break;
> > case 9: id = " " + lidNr;
> > break;
> > case 10: id = lidNr;
> > break;
> >
> > }
> > stmt.setString(++x, id);
> >
> > But it works.
>
> --
> Mark Rotteveel <Avalanche1979@ <mailto:Avalanche1979%40gmx.net>
>
>
>
>
>
> [Non-text portions of this message have been removed]
>