Re: [INTERFACES] ecpg idea

From: James Thompson <jamest(at)math(dot)ksu(dot)edu>
To: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Michael Meskes <Michael_Meskes(at)topmail(dot)de>, PostgreSQL Interfaces <pgsql-interfaces(at)postgreSQL(dot)org>
Subject: Re: [INTERFACES] ecpg idea
Date: 1999-02-20 18:56:28
Message-ID: Pine.GSO.4.05.9902201245470.5372-100000@noether.math.ksu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Sat, 20 Feb 1999, Thomas G. Lockhart wrote:

> > ... if you provide a char * you have to make sure it has memory
> > allocated yourself. James now asked me to do the correct malloc()
> > inside libecpg if that poointer is NULL.
> > I never heard about a feature like this on other DBMS but I like the
> > idea. It should be pretty easy to implement too. Unless it is strictly
> > against standard I would like to implement it.
> > Comments anyone?
>
> How do you get back the handle for the newly malloc'd storage?
>

I'm not sure I understand. Are your talking about the pointer value?
This was my original idea converted into code. I was hoping to reduce the
amount of possible buffer overflows due to field size changes in a
database table, plus reduce client code maintenance.

exec sql begin declare
char *name;
exec sql end declare

name = NULL;

exec sql select first_name
into :name
from customer;

if (name){
printf("The value is %s",name);
free(name);
}

If this doesn't fly is there a way to get table field lengths at run time.
I just don't like hard coded array sizes linked to table fields. I'd
rather malloc the memory prior to the fetch.

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson 138 Cardwell Hall Manhattan, Ks 66506 785-532-0561
Kansas State University Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Al Kirkus 1999-02-20 19:56:53 (no subject)
Previous Message James Thompson 1999-02-20 18:45:27 Re: [INTERFACES] ecpg idea