pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
select count(*) datatype ?
4+ messages / 2 participants
[nested] [flat]

* select count(*) datatype ?
@ 2005-09-30 11:03  lothar.behrens@lollisoft.de
  0 siblings, 2 replies; 4+ messages in thread

From: lothar.behrens@lollisoft.de @ 2005-09-30 11:03 UTC (permalink / raw)
  To: pgsql-odbc

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






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select count(*) datatype ?
@ 2005-09-30 13:54  Tom Lane <tgl@sss.pgh.pa.us>
  parent: lothar.behrens@lollisoft.de
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2005-09-30 13:54 UTC (permalink / raw)
  To: lothar.behrens@lollisoft.de; +Cc: pgsql-odbc

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



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select count(*) datatype ?
@ 2005-09-30 15:57  lothar.behrens@lollisoft.de
  parent: lothar.behrens@lollisoft.de
  1 sibling, 0 replies; 4+ messages in thread

From: lothar.behrens@lollisoft.de @ 2005-09-30 15:57 UTC (permalink / raw)
  To: pgsql-odbc

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






^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: select count(*) datatype ?
@ 2005-10-01 08:30  lothar.behrens@lollisoft.de
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: lothar.behrens@lollisoft.de @ 2005-10-01 08:30 UTC (permalink / raw)
  To: pgsql-odbc

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






^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-10-01 08:30 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-30 11:03 select count(*) datatype ? lothar.behrens@lollisoft.de
2005-09-30 13:54 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-10-01 08:30   ` lothar.behrens@lollisoft.de
2005-09-30 15:57 ` lothar.behrens@lollisoft.de

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox