Browse files

fixed SETRANGE

  • Loading branch information...
1 parent 5afe9e5 commit d8ee0e4c2d69b73d8c299c8422d7c500991dd667 @tj committed Apr 15, 2011
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/commands/string.js
View
11 lib/commands/string.js
@@ -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();
}

0 comments on commit d8ee0e4

Please sign in to comment.