Skip to content

Commit

Permalink
fixed SETRANGE
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Apr 15, 2011
1 parent 5afe9e5 commit d8ee0e4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/commands/string.js
Expand Up @@ -202,16 +202,15 @@ exports.strlen = function(client, key){
*/

(exports.setrange = function(client, key, offset, str){
var key = string(key)
, val = this.data[key]
var obj = this.lookup(string(key))
, offset = +string(offset);


if (null == val) {
if (!obj) {
// TODO: finish
} else if ('string' == this.keyType(key)) {
str.copy(val, offset);
client.int(val.length);
} else if ('string' == obj.type) {
str.copy(obj.val, offset);
client.int(obj.val.length);
} else {
client.typeError();
}
Expand Down

0 comments on commit d8ee0e4

Please sign in to comment.