pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
NAN-Values in ECPG-Code
2+ messages / 2 participants
[nested] [flat]

* NAN-Values in ECPG-Code
@ 2007-06-15 13:38  René Grün <rgr@mbs-software.de>
  0 siblings, 1 reply; 2+ messages in thread

From: René Grün @ 2007-06-15 13:38 UTC (permalink / raw)
  To: pgsql-interfaces


Greetings,

this is my first post in an newslist, so pleas be patient, if I made some formal mistakes.

I have a Question:

Im writing a program in c using the ecpg-library. How can I insert a float-value like 'NAN' or 'infinity' into a recordset?

( this is only an example ... )

EXEC SQL BEGIN DECLARE SECTION;
Int	paramid;
Float fval;
EXEC SQL END DECLARE SECTION;

paramid = 5;
fval = 'NAN';

EXEC SQL INSERT INTO test ( paramid, value ) VALUES ( :paramid, :fval );

This is only working for 'normal' values, but not for the special's - NAN and INFINITY...

Can You help me, and tell me how to do it? 
I would be very thankful.


Mit freundlichen Grüßen aus Krefeld,
With best regards from Krefeld,


MBS GmbH - Entwicklung
i.A. René Grün

E-Mail: Rene.Gruen@mbs-software.de

Visit us in the world wide web:
Besuchen Sie uns im Internet:          
http://www.mbs-software.de

--

MBS Gesellschaft für Entwicklung und
Handel von Software und Investitionsgütern mbH Römerstraße 15, D-47809 Krefeld
Geschäftsführer: Martin Brust-Theiß, Gerhard Memmen-Krüger Registergericht Krefeld HRB 3337 Ust.-ID:DE 120 148 529





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

* Re: NAN-Values in ECPG-Code
@ 2007-09-03 11:09  Michael Meskes <meskes@postgresql.org>
  parent: René Grün <rgr@mbs-software.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 2007-09-03 11:09 UTC (permalink / raw)
  To: René Grün <rgr@mbs-software.de>; +Cc: pgsql-interfaces

On Fri, Jun 15, 2007 at 03:38:03PM +0200, René Grün wrote:
> I have a Question:

Sorry for the late answer, but I still have a backlog in my emails.

> EXEC SQL BEGIN DECLARE SECTION;
> Int	paramid;
> Float fval;
> EXEC SQL END DECLARE SECTION;
> 
> paramid = 5;
> fval = 'NAN';

How about this?

fval = strtod("nan", NULL);

> Mit freundlichen Grüßen aus Krefeld,
> With best regards from Krefeld,

Being very close in Moenchengladbach I hope this helps.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!



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


end of thread, other threads:[~2007-09-03 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-15 13:38 NAN-Values in ECPG-Code René Grün <rgr@mbs-software.de>
2007-09-03 11:09 ` Michael Meskes <meskes@postgresql.org>

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