예제 #1
0
void CSInstance :: Fill (Instance insthandle, DBStructDef *strdef, int32 instlen, logical conversion, logical append )
{
  char       *area;
  logical     inst_conversion = conversion;
BEGINSEQ
  if ( !strdef || strdef->smcbityp == T_MEMO || strdef->smcbityp == T_BLOB )
    inst_conversion = NO;
  else
    instlen = strdef->GetLength();
  
  if ( !(area = Setup(CPT_instance,!insthandle ? 0 : inst_conversion ? strdef->get_net_length() : instlen,conversion,append)) )
                                                     ERROR
  if ( insthandle.GetData() )
  {
    if ( inst_conversion )
      strdef->IntToNet(area,(char *)insthandle.GetData());
    else
      memcpy(area,insthandle.GetData(),instlen);
  }
  converted = NO;

RECOVER

ENDSEQ

}
예제 #2
0
void CSInstance :: Fill (Instance insthandle, DBFieldDef *field_def, logical conversion, logical append )
{
  char      *area;
  logical    inst_conversion = conversion;
  int32       length = 0;
BEGINSEQ
  if ( field_def->fmcbityp == T_MEMO || 
       field_def->fmcbityp == T_BLOB || 
       field_def->fmcbityp == T_STRING    )
  {
    inst_conversion = NO;
    if ( insthandle.GetData() )
    {
      length = strlen((char *)insthandle.GetData()) + 1;
      length = MIN(field_def->get_net_length(),length);
    }
  }
  else
    length = field_def->fmcbbyte;
    
  if ( !(area = Setup(CPT_instance,!insthandle ? 0 : inst_conversion ? field_def->get_net_length() : length,conversion,append)) )
                                                     ERROR
  if ( insthandle.GetData() )
  {
    if ( inst_conversion )
      field_def->IntToNet(area,(char *)insthandle.GetData());
    else
      memcpy(area,insthandle.GetData(),length);
  }
  converted = NO;

RECOVER

ENDSEQ

}