From: Ines.Klimann@liafa.jussieu.fr
To: pgsql-sql@postgresql.org
Subject: insert values
Date: Thu, 22 Feb 2001 13:52:22 +0100
Message-ID: <20010222135222.A14873@liafa0.liafa.jussieu.fr> (raw)
Hi,
I have the following type :
--------------------------------------------
CREATE FUNCTION entier_in(opaque)
RETURNS entier
AS '/ens/klimann/PostgreSQL/entier.o'
LANGUAGE 'c';
CREATE FUNCTION entier_out(opaque)
RETURNS opaque
AS '/ens/klimann/PostgreSQL/entier.o'
LANGUAGE 'c';
CREATE TYPE entier (
internallength = 8,
input = entier_in,
output = entier_out
);
--------------------------------------------
where entier.c is the following program :
--------------------------------------------
#include <stdio.h>
typedef struct entier {
long x;
} entier;
entier * entier_in(char *s)
{
entier *result;
result = (entier *)malloc(sizeof(entier));
result->x = atoi(s);
return (result);
}
char * entier_out(entier *n)
{
char *result;
if (n == NULL)
return(NULL);
result = (char *) malloc(60);
sprintf(result, "%d", n->x);
return(result);
}
----------------------------------------------
then I create the table entiers as follows :
----------------------------------------------
CREATE TABLE entiers (
val entier
);
----------------------------------------------
How can I insert a value in this table ?
I have tried several methods, but I can't find
a correct one.
Does someone have an idea ?
Thanks a lot,
Ines.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Ines.Klimann@liafa.jussieu.fr
Subject: Re: insert values
In-Reply-To: <20010222135222.A14873@liafa0.liafa.jussieu.fr>
References: <20010222135222.A14873@liafa0.liafa.jussieu.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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