Add support for "text" datatypes in json output format
This commit is contained in:
parent
78a80e6c82
commit
ba28496127
@ -14,7 +14,7 @@ var typeNames = {
|
|||||||
20: 'number',
|
20: 'number',
|
||||||
21: 'number',
|
21: 'number',
|
||||||
23: 'number',
|
23: 'number',
|
||||||
25: 'string',
|
25: 'string', // text
|
||||||
26: 'number',
|
26: 'number',
|
||||||
114: 'object', // JSON
|
114: 'object', // JSON
|
||||||
701: 'number',
|
701: 'number',
|
||||||
|
@ -841,7 +841,8 @@ test('field names and types are exposed', function(done){
|
|||||||
assert.response(app, {
|
assert.response(app, {
|
||||||
url: '/api/v1/sql?' + querystring.stringify({
|
url: '/api/v1/sql?' + querystring.stringify({
|
||||||
q: "SELECT 1::int as a, 2::float8 as b, 3::varchar as c, " +
|
q: "SELECT 1::int as a, 2::float8 as b, 3::varchar as c, " +
|
||||||
"4::char as d, now() as e, 'POINT(0 0)'::geometry as the_geom " +
|
"4::char as d, now() as e, 'a'::text as f, " +
|
||||||
|
"'POINT(0 0)'::geometry as the_geom " +
|
||||||
"LIMIT 0"
|
"LIMIT 0"
|
||||||
}),
|
}),
|
||||||
headers: {host: 'vizzuality.cartodb.com'},
|
headers: {host: 'vizzuality.cartodb.com'},
|
||||||
@ -849,12 +850,13 @@ test('field names and types are exposed', function(done){
|
|||||||
},{ }, function(res) {
|
},{ }, function(res) {
|
||||||
assert.equal(res.statusCode, 200, res.body);
|
assert.equal(res.statusCode, 200, res.body);
|
||||||
var parsedBody = JSON.parse(res.body);
|
var parsedBody = JSON.parse(res.body);
|
||||||
assert.equal(_.keys(parsedBody.fields).length, 6);
|
assert.equal(_.keys(parsedBody.fields).length, 7);
|
||||||
assert.equal(parsedBody.fields.a.type, 'number');
|
assert.equal(parsedBody.fields.a.type, 'number');
|
||||||
assert.equal(parsedBody.fields.b.type, 'number');
|
assert.equal(parsedBody.fields.b.type, 'number');
|
||||||
assert.equal(parsedBody.fields.c.type, 'string');
|
assert.equal(parsedBody.fields.c.type, 'string');
|
||||||
assert.equal(parsedBody.fields.d.type, 'string');
|
assert.equal(parsedBody.fields.d.type, 'string');
|
||||||
assert.equal(parsedBody.fields.e.type, 'date');
|
assert.equal(parsedBody.fields.e.type, 'date');
|
||||||
|
assert.equal(parsedBody.fields.f.type, 'string');
|
||||||
assert.equal(parsedBody.fields.the_geom.type, 'geometry');
|
assert.equal(parsedBody.fields.the_geom.type, 'geometry');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user