Unix Technical Forum

select count(*) datatype ?

This is a discussion on select count(*) datatype ? within the pgsql Interfaces odbc forums, part of the PostgreSQL category; --> Hi, what type of column is an aggregated value of count ? Currently I support SQL_CHAR,SQL_INT,... but something seems ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces odbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 02:27 AM
lothar.behrens@lollisoft.de
 
Posts: n/a
Default select count(*) datatype ?

Hi,

what type of column is an aggregated value of count ?

Currently I support SQL_CHAR,SQL_INT,... but something seems to
be missed.

Thanks, Lothar

--
Lothar Behrens | Rapid Prototyping ...
Rosmarinstr 3 |
40235 Düsseldorf | www.lollisoft.de




---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2008, 02:27 AM
Tom Lane
 
Posts: n/a
Default Re: select count(*) datatype ?

lothar.behrens@lollisoft.de writes:
> what type of column is an aggregated value of count ?


bigint, at least in recent PG releases.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-16-2008, 02:27 AM
lothar.behrens@lollisoft.de
 
Posts: n/a
Default Re: select count(*) datatype ?

Am 30 Sep 2005 um 9:54 hat Tom Lane geschrieben:

> lothar.behrens@lollisoft.de writes:
> > what type of column is an aggregated value of count ?

>
> bigint, at least in recent PG releases.
>
> regards, tom lane
>


Thanks,

but now I am a little confused about how to convert those datatypes to a char[] type.

I write long datatypes from char[] array into bound buffer:

long l = 0;
l = atol("long value");
long* pl = (long*) buffer;
void* b = pl+1;
memcpy(b, &l, sizeof(l));

I read long datatypes into char[] array from bound buffer:

char charrep[100] = "";
sprintf(charrep, "%d", *(long*) buffer);
result->setData(charrep);

How do I this for bigint datatypes (long long as I think) ?

Thanks

Lothar

--
Lothar Behrens | Rapid Prototyping ...
Rosmarinstr 3 |
40235 Düsseldorf | www.lollisoft.de




---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-16-2008, 02:27 AM
lothar.behrens@lollisoft.de
 
Posts: n/a
Default Re: select count(*) datatype ?

Am 30 Sep 2005 um 17:57 hat lothar.behrens@lollisoft.de geschrieben:

I have solved that problem. Open Watcom has a function atoll and lltoa for long
long conversion. I'll try this on Linux and Mac later, there may be similar functions.

Lothar

> Am 30 Sep 2005 um 9:54 hat Tom Lane geschrieben:
>
> > lothar.behrens@lollisoft.de writes:
> > > what type of column is an aggregated value of count ?

> >
> > bigint, at least in recent PG releases.
> >
> > regards, tom lane
> >

>
> Thanks,
>
> but now I am a little confused about how to convert those datatypes to a char[] type.
>
> I write long datatypes from char[] array into bound buffer:
>
> long l = 0;
> l = atol("long value");
> long* pl = (long*) buffer;
> void* b = pl+1;
> memcpy(b, &l, sizeof(l));
>
> I read long datatypes into char[] array from bound buffer:
>
> char charrep[100] = "";
> sprintf(charrep, "%d", *(long*) buffer);
> result->setData(charrep);
>
> How do I this for bigint datatypes (long long as I think) ?
>
> Thanks
>
> Lothar
>
> --
> Lothar Behrens | Rapid Prototyping ...
> Rosmarinstr 3 |
> 40235 Düsseldorf | www.lollisoft.de
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>



--
Lothar Behrens | Rapid Prototyping ...
Rosmarinstr 3 |
40235 Düsseldorf | www.lollisoft.de




---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com