dis_sql/src/sql_iff.cxx
//
// add_attribute - Add the attribute text label with an optional value.
//
Add the attribute text label with an optional value.
Add the attribute text label with an optional value .
void iff_relation::add_attribute (const char *attribute,
				  const char* value_str ) {
   int len = strlen (attribute);
   if (value_str) {
      len += strlen (value_str) + 2;	
   }
   if (attr_idx) {
      len += 2;
   }
   if (attr_idx + len + 1 >= attr_buffer_size) {
      iff_error ("attribute buffer overflow");
   } else {
      if (attr_idx) {
	 *(attr_buffer + attr_idx++) = ',';
	 *(attr_buffer + attr_idx++) = ' ';
      }
      if (value_str) {
	 sprintf (attr_buffer + attr_idx, "%s(%s)", attribute, value_str);
      } else {
	 strcat (attr_buffer + attr_idx, attribute);
      }
      attr_idx += len;
   }
}
void iff_relation :: add_attribute ( const char * attribute , const char * value_str ) { int len = strlen ( attribute ) ; if ( value_str ) { len += strlen ( value_str ) + 2 ; } if ( attr_idx ) { len += 2 ; } if ( attr_idx + len + 1 >= attr_buffer_size ) { iff_error ( " " ) ; } else { if ( attr_idx ) { * ( attr_buffer + attr_idx ++ ) = ' ' ; * ( attr_buffer + attr_idx ++ ) = ' ' ; } if ( value_str ) { sprintf ( attr_buffer + attr_idx , " " , attribute , value_str ) ; } else { strcat ( attr_buffer + attr_idx , attribute ) ; } attr_idx += len ; } }
add_attribute - Add the attribute text label with an optional value.
add_attribute - Add the attribute text label with an optional value .
/* = 0 */ // 2: open + close paren // add length (2) for comma + space if this is not first attribute // check for string overflow including 0 terminator // now add comma + space if this is not first attribute // increment buffer index to terminating 0 for next addition