示例#1
0
_Tt_db_results _Tt_db_client::gettype(const _Tt_string &objid,
				      _Tt_string       &type)
{
	_Tt_spec_props *res;
	_Tt_spec_props args;
	_Tt_prop props, *propp;
	_Tt_db_results retval;
	
	_Tt_string partition = objid;
	_Tt_string temp_string;
	
	// Get rid of file system type and hostname - the partition
		// is the only thing left
			partition = partition.split(':', temp_string);
	partition = partition.split(':', temp_string);
	partition = partition.split(':', temp_string);
	
	_Tt_old_db_partition_map_ref map;
	_Tt_old_db_ptr old_db = map.getDB(partition, this);
	_Tt_db_key object_key(objid);
	
	args.isfd = old_db->propertyTableFD;
	args.key = old_db->propertyTablePropertyKey->getKeyDescriptor();
	args.key_len = TT_OLD_DB_KEY_LENGTH + TT_OLD_DB_MAX_PROPERTY_NAME_LENGTH;
	args.oidkey.oidkey_len = TT_OLD_DB_KEY_LENGTH;
	args.oidkey.oidkey_val = (char *)object_key.binary();
	args.props.props_len = 1;
	args.props.props_val = &props;
	props.propname.propname_val = TT_OLD_DB_OBJECT_TYPE_PROPERTY;
	props.propname.propname_len = strlen(TT_OLD_DB_OBJECT_TYPE_PROPERTY);
	props.recnum = 0;
	props.value.value_len = 0;
	props.value.value_val = 0;
	res = _tt_gettype_1(&args, dbServer);
	if (res->result == TT_DB_OK) {
		propp = &(res->props.props_val[0]);
		type.set((unsigned char *)propp->value.value_val,
			 propp->value.value_len);
	}
	retval = oldDBToNewDBResults((_Tt_old_db_results)res->result);
	xdr_free((xdrproc_t)xdr_Tt_spec_props, (char *)res);
	return retval;
}
示例#2
0
void json_writer::error(const std::string &s) {
  start_object();
  object_key("error");
  entry_string(s);
  end_object();
}