Allow sql queries to end with a semicolon. Closes #90
This commit is contained in:
parent
e7437ba7cd
commit
0ec66c69a7
1
NEWS.md
1
NEWS.md
@ -1,6 +1,7 @@
|
||||
1.3.8
|
||||
-----
|
||||
* Make using SET or querying system catalogues harder
|
||||
* Allow sql queries to end with a semicolon (#90)
|
||||
|
||||
1.3.7
|
||||
-----
|
||||
|
@ -502,6 +502,9 @@ function toOGR(dbname, user_id, gcol, sql, skipfields, out_format, out_filename,
|
||||
|
||||
var columns = [];
|
||||
|
||||
// Drop ending semicolon (ogr doens't like it)
|
||||
sql = sql.replace(/;\s*$/, '');
|
||||
|
||||
Step (
|
||||
|
||||
function fetchColumns() {
|
||||
|
@ -176,4 +176,21 @@ test('GET /api/v1/sql as kml with no rows', function(done){
|
||||
});
|
||||
});
|
||||
|
||||
// See https://github.com/Vizzuality/CartoDB-SQL-API/issues/90
|
||||
test('GET /api/v1/sql as kml with ending semicolon', function(done){
|
||||
assert.response(app, {
|
||||
url: '/api/v1/sql?' + querystring.stringify({
|
||||
q: 'SELECT true WHERE false;',
|
||||
format: 'kml'
|
||||
}),
|
||||
headers: {host: 'vizzuality.cartodb.com'},
|
||||
method: 'GET'
|
||||
},{ }, function(res){
|
||||
assert.equal(res.statusCode, 200, res.body);
|
||||
var body = '<?xml version="1.0" encoding="utf-8" ?>\n<kml xmlns="http://www.opengis.net/kml/2.2">\n<Document><Folder><name>sql_statement</name>\n</Folder></Document></kml>\n';
|
||||
assert.equal(res.body, body);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user