On 6 January 2011 03:43, Richard Hipp <[email protected]> wrote:

> On Wed, Jan 5, 2011 at 10:27 PM, Vannus <[email protected]> wrote:
>
> > I know sqlite stores data as text,
>
>
> No it doesn't, unless the value really is text.
>
>
> > but why does
> > count(1) and cast(count(1) as integer) give a text result?
> >
>
> It will give you the result in any format you ask it to.  The conversion is
> automatic.  If you ask for text (using sqlite3_column_text() or
> sqlite3_column_text16()) then you'll get text.  If you ask for an integer
> (using sqlite3_column_int() or sqlite3_column_int64()) then you'll get an
> integer.
>
> What routine are using to extract the value?
>

i've got no idea! I use

SELECT
  Orders.ID AS OrderID,
  Mixes.ID AS MixID,
  Mixes.Percentage AS Percentage,
/* count(1),*/
/* cast(cout(1) as integer), */
/* 1 as one,*/
/* cast(1 as integer) AS one,*/
  (Orders.Total/100)*Mixes.Percentage AS SubTotal
FROM
  Orders, Mixes

Using both ZeosLib and SQLite Expert the SubTotal (and count if inserted) is
returned as text


>
>
> > more to the point, why does cast(((myfloatfield*myotherfloatfield)/100)
> as
> > real) give a text result!
> >
> > this is really irritating as i've put a lot of time into a project for
> > someone only to be unable to complete it.
> >
> > im on latest 3.7.4 precompiled dll from sqlite website. im not seeing
> much
> > else on the net for this at all, but it happens with different software
> > using different sqlite 3 dll sub- versions.
> >
> > Thanks for any help, Jim.
> > _______________________________________________
> > sqlite-users mailing list
> > [email protected]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> [email protected]
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to