Add --skipfields switch to cdbsql

This commit is contained in:
Sandro Santilli 2013-05-29 12:35:08 +02:00
parent 9475e6ef0a
commit 476bd863b4

View File

@ -33,6 +33,7 @@ function usage(exit_code) {
console.log(" --key <string> API authentication key (none)");
console.log(" --format <string> Response format (json)");
console.log(" --dp <num> Decimal places in geojson format (unspecified)");
console.log(" --skipfields <string> Comma-separated list of fields to skip (none)");
console.log(" --echo-queries echo commands sent to server");
if ( hasReadline ) {
console.log(" --batch Send all read queries at once (off)");
@ -53,6 +54,7 @@ var api_key;
var sql;
var decimal_places;
var echo_queries = false;
var skipfields;
var arg;
while ( arg = process.argv.shift() ) {
@ -86,6 +88,9 @@ while ( arg = process.argv.shift() ) {
else if ( arg == '--batch' ) {
batch_mode = true;
}
else if ( arg == '--skipfields' ) {
skipfields = process.argv.shift();
}
else if ( arg == '--echo-queries' ) {
echo_queries = true;
}
@ -172,6 +177,7 @@ function processQuery(sql, callback)
if ( typeof(api_key) != 'undefined' ) opt.path += '&api_key=' + api_key;
if ( typeof(decimal_places) != 'undefined' ) opt.path += '&dp=' + decimal_places;
if ( typeof(skipfields) != 'undefined' ) opt.path += '&skipfields=' + encodeURIComponent(skipfields);
var body = '';
var request = 'http://' + opt.host + ':' + opt.port + opt.path;