src/ssdb/t_hash.cpp
// returns the number of newly added items
returns the number of newly added items
returns the number of newly added items
static int hset_one(SSDBImpl *ssdb, const Bytes &name, const Bytes &key, const Bytes &val, char log_type){
	if(name.empty() || key.empty()){
		log_error("empty name or key!");
		return -1;
	}
	if(name.size() > SSDB_KEY_LEN_MAX ){
		log_error("name too long! %s", hexmem(name.data(), name.size()).c_str());
		return -1;
	}
	if(key.size() > SSDB_KEY_LEN_MAX){
		log_error("key too long! %s", hexmem(key.data(), key.size()).c_str());
		return -1;
	}
	int ret = 0;
			std::string hkey = encode_hash_name(name);
			std::string new_value = encode_hash_value(key, val);
			ssdb->binlogs->Merge(hkey, slice(new_value));
			ssdb->binlogs->add_log(log_type, BinlogCommand::HSET, hkey);
	return ret;
}
static int hset_one ( SSDBImpl * ssdb , const Bytes & name , const Bytes & key , const Bytes & val , char log_type ) { if ( name . empty ( ) || key . empty ( ) ) { log_error ( " " ) ; return -1 ; } if ( name . size ( ) > SSDB_KEY_LEN_MAX ) { log_error ( " " , hexmem ( name . data ( ) , name . size ( ) ) . c_str ( ) ) ; return -1 ; } if ( key . size ( ) > SSDB_KEY_LEN_MAX ) { log_error ( " " , hexmem ( key . data ( ) , key . size ( ) ) . c_str ( ) ) ; return -1 ; } int ret = 0 ; std :: string hkey = encode_hash_name ( name ) ; std :: string new_value = encode_hash_value ( key , val ) ; ssdb -> binlogs -> Merge ( hkey , slice ( new_value ) ) ; ssdb -> binlogs -> add_log ( log_type , BinlogCommand :: HSET , hkey ) ; return ret ; }
returns the number of newly added items
returns the number of newly added items
//	std::string dbval; //	if(ssdb->hget(name, key, &dbval) == 0){ // not found //		std::string hkey = encode_hash_key(name, key); //		ssdb->binlogs->Put(hkey, slice(val)); //		ssdb->binlogs->add_log(log_type, BinlogCommand::HSET, hkey); //		ret = 1; //	}else{ //		if(dbval != val){ //		} //		ret = 0; //	}