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
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<