Hi,
I would like to use storage and views to return a structured table of data instead of painful char** and double**.
So I built a c4_Storage and return it. I'm not used to this syntax (I always use pointers). Is it safe to do that :


c4_Storage execute0_sub()
{
  printf("test mem only storage\n");
  c4_Storage  sto;
  c4_View     view=sto.GetAs("myview[id:S,data:D]");
  c4_Row      row;
  c4_StringProp   id("id");
  c4_DoubleProp   data("data");
  id(row)="one";
  data(row)=1;
  view.Add(row);
  id(row)="two";
  data(row)=2;
  view.Add(row);
  return(sto);
}

void execute0()
{
  printf("test mem only storage\n");
  long idx;
  c4_Storage  sto=execute0_sub();
  c4_View     view=sto.GetAs("myview[id:S,data:D]");
  c4_StringProp   id("id");
  c4_DoubleProp   data("data");
  for (idx=0;idx<view.GetSize();idx++)
    printf("id='%s',data=%f\n",(const char*)id(view[idx]),(double)data(view[idx]));
}

in particular returning an object that is local to the function ???
It works but I need confirmation
Thanks

--
Riccardo Cohen

Articque
Les Roches
37230 Fondettes
France
web = http://www.articque.com
tel: +33 02 47 49 90 49
fax: +33 02 47 49 91 49


_____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit

Reply via email to