[V4RB] Different results with SQL and BaseObject

Christer Olsson christer at ljusaideer.se
Tue Apr 15 10:09:30 CDT 2003


>on 4/15/03 12:36 AM, Christer Olsson at christer at ljusaideer.se wrote:
>
>Hi Christer,
>
> > When storing strings containing ASCII > 127 I get different 
>results when using
> > SQLExecute and BaseObject Record methods. I'm storing values entered by the
> > user in editfields, and I convert them to MacRoman before storing 
>them with:
> >
> > s = convertEncoding(value, encodings.macRoman)
> >
> > This will store a "raw" UTF string in the database:
> >
> > recCount = app.mEOrderDatabase.SQLExecute("UPDATE Installningar 
>SET varde_fld
> > = '" + s  + "' WHERE namn_fld = " + falt)
> >
> > But this will store MacRoman encoded strings:
> >
> > app.mEOrderDatabase.mInstallningar.vardeFld.SetString(s)
> > app.mEOrderDatabase.mInstallningar.namnFld.SetString(falt)
> > app.mEOrderDatabase.mInstallningar.AddRecord
> >
> > i.e if the Editfield.text is "Lösenord" the SQLExecute will store 
>"Lˆsenord",
> > but the BaseObject method will store "Lösenord".
>
>1) so which is wrong ?
>    It seems to me SqlExecute()?
>    But if you give it MacRoman string then it do not convert it self to
>UTF! Valentina do not know about UTF yet. May be problem in wrong language
>property ?

SQLExecute is wrong, and is so because I'm stupid :-) When re-reading my posting it's obvious the encoding is lost in RBs concatenation of the SQL query:

"UPDATE Installningar SET varde_fld = '" + s  + "' WHERE namn_fld = " + falt

I must use the same encoding for the whole string :-)

>2) what language you use for that field ?

Swedish.
-- 

  *************************************************************
  Christer Olsson   PO Box 9160        Phone +46 40 25 85 85
  Ljusa Idéer AB    SE-200 39 Malmoe   Fax +46 40 25 85 89
  Kantyxegatan 5    Sweden             http://www.ljusaideer.se


More information about the Valentina mailing list