|
|
@ -1742,10 +1742,12 @@ Options BatchPutCommand::PrepareOptionsForOpenDB() { |
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
ScanCommand::ScanCommand(const vector<string>& params, |
|
|
|
ScanCommand::ScanCommand(const vector<string>& params, |
|
|
|
const map<string, string>& options, const vector<string>& flags) : |
|
|
|
const map<string, string>& options, |
|
|
|
LDBCommand(options, flags, true, |
|
|
|
const vector<string>& flags) |
|
|
|
BuildCmdLineOptions({ARG_TTL, ARG_NO_VALUE, ARG_HEX, ARG_KEY_HEX, ARG_TO, |
|
|
|
: LDBCommand(options, flags, true, |
|
|
|
ARG_VALUE_HEX, ARG_FROM, ARG_TIMESTAMP, |
|
|
|
BuildCmdLineOptions( |
|
|
|
|
|
|
|
{ARG_TTL, ARG_NO_VALUE, ARG_HEX, ARG_KEY_HEX, |
|
|
|
|
|
|
|
ARG_TO, ARG_VALUE_HEX, ARG_FROM, ARG_TIMESTAMP, |
|
|
|
ARG_MAX_KEYS, ARG_TTL_START, ARG_TTL_END})), |
|
|
|
ARG_MAX_KEYS, ARG_TTL_START, ARG_TTL_END})), |
|
|
|
start_key_specified_(false), |
|
|
|
start_key_specified_(false), |
|
|
|
end_key_specified_(false), |
|
|
|
end_key_specified_(false), |
|
|
@ -1769,7 +1771,8 @@ ScanCommand::ScanCommand(const vector<string>& params, |
|
|
|
end_key_specified_ = true; |
|
|
|
end_key_specified_ = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
vector<string>::const_iterator vitr = std::find(flags.begin(), flags.end(), ARG_NO_VALUE); |
|
|
|
vector<string>::const_iterator vitr = |
|
|
|
|
|
|
|
std::find(flags.begin(), flags.end(), ARG_NO_VALUE); |
|
|
|
if (vitr != flags.end()) { |
|
|
|
if (vitr != flags.end()) { |
|
|
|
no_value_ = true; |
|
|
|
no_value_ = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -1858,8 +1861,8 @@ void ScanCommand::DoCommand() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (no_value_) { |
|
|
|
if (no_value_) { |
|
|
|
fprintf(stdout, "%.*s\n", |
|
|
|
fprintf(stdout, "%.*s\n", static_cast<int>(key_slice.size()), |
|
|
|
static_cast<int>(key_slice.size()), key_slice.data()); |
|
|
|
key_slice.data()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Slice val_slice = it->value(); |
|
|
|
Slice val_slice = it->value(); |
|
|
|
std::string formatted_value; |
|
|
|
std::string formatted_value; |
|
|
@ -1867,9 +1870,9 @@ void ScanCommand::DoCommand() { |
|
|
|
formatted_value = "0x" + val_slice.ToString(true /* hex */); |
|
|
|
formatted_value = "0x" + val_slice.ToString(true /* hex */); |
|
|
|
val_slice = formatted_value; |
|
|
|
val_slice = formatted_value; |
|
|
|
} |
|
|
|
} |
|
|
|
fprintf(stdout, "%.*s : %.*s\n", |
|
|
|
fprintf(stdout, "%.*s : %.*s\n", static_cast<int>(key_slice.size()), |
|
|
|
static_cast<int>(key_slice.size()), key_slice.data(), |
|
|
|
key_slice.data(), static_cast<int>(val_slice.size()), |
|
|
|
static_cast<int>(val_slice.size()), val_slice.data()); |
|
|
|
val_slice.data()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
num_keys_scanned++; |
|
|
|
num_keys_scanned++; |
|
|
|