@@ -79,12 +79,11 @@ result_t LevelDB::has(Buffer_base* key, bool& retVal, AsyncEvent* ac)
79
79
if (ac->isSync ())
80
80
return CHECK_ERROR (CALL_E_NOSYNC);
81
81
82
- exlib::string key1;
83
- key->toString (key1);
82
+ Buffer* buf = (Buffer*)key;
84
83
85
84
std::string value;
86
85
leveldb::Status s = db ()->Get (leveldb::ReadOptions (),
87
- leveldb::Slice (key1. c_str (), key1. length ()),
86
+ leveldb::Slice (( const char *)buf-> data (), buf-> length ()),
88
87
&value);
89
88
if (s.IsNotFound ()) {
90
89
retVal = false ;
@@ -105,12 +104,11 @@ result_t LevelDB::get(Buffer_base* key, obj_ptr<Buffer_base>& retVal, AsyncEvent
105
104
if (ac->isSync ())
106
105
return CHECK_ERROR (CALL_E_NOSYNC);
107
106
108
- exlib::string key1;
109
- key->toString (key1);
107
+ Buffer* buf = (Buffer*)key;
110
108
111
109
std::string value;
112
110
leveldb::Status s = db ()->Get (leveldb::ReadOptions (),
113
- leveldb::Slice (key1. c_str (), key1. length ()),
111
+ leveldb::Slice (( const char *)buf-> data (), buf-> length ()),
114
112
&value);
115
113
if (s.IsNotFound ())
116
114
return CALL_RETURN_NULL;
@@ -208,14 +206,11 @@ result_t LevelDB::set(Buffer_base* key, Buffer_base* value, AsyncEvent* ac)
208
206
if (ac->isSync ())
209
207
return CHECK_ERROR (CALL_E_NOSYNC);
210
208
211
- exlib::string key1 ;
212
- key-> toString (key1) ;
209
+ Buffer* buf_key = (Buffer*)key ;
210
+ Buffer* buf_val = (Buffer*)value ;
213
211
214
- exlib::string value1;
215
- value->toString (value1);
216
-
217
- leveldb::Status s = Set (leveldb::Slice (key1.c_str (), key1.length ()),
218
- leveldb::Slice (value1.c_str (), value1.length ()));
212
+ leveldb::Status s = Set (leveldb::Slice ((const char *)buf_key->data (), buf_key->length ()),
213
+ leveldb::Slice ((const char *)buf_val->data (), buf_val->length ()));
219
214
if (!s.ok ())
220
215
return CHECK_ERROR (error (s));
221
216
@@ -293,11 +288,10 @@ result_t LevelDB::remove(Buffer_base* key, AsyncEvent* ac)
293
288
if (ac->isSync ())
294
289
return CHECK_ERROR (CALL_E_NOSYNC);
295
290
296
- exlib::string key1;
297
- key->toString (key1);
291
+ Buffer* buf = (Buffer*)key;
298
292
299
293
exlib::string value;
300
- leveldb::Status s = Delete (leveldb::Slice (key1. c_str (), key1. length ()));
294
+ leveldb::Status s = Delete (leveldb::Slice (( const char *)buf-> data (), buf-> length ()));
301
295
if (!s.ok ())
302
296
return CHECK_ERROR (error (s));
303
297
0 commit comments