From 82f965fa57c71957997fbd41cc1cd577a791462d Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Wed, 2 Oct 2013 12:32:07 +0200 Subject: [PATCH] Upgrade node-pg dependency to 2.6.2 Simplifies PSQL.quoteIdentifier and exposes PSQL.quoteLiteral --- NEWS.md | 1 + app/models/psql.js | 23 ++--------------------- npm-shrinkwrap.json | 6 +++--- package.json | 2 +- 4 files changed, 7 insertions(+), 25 deletions(-) diff --git a/NEWS.md b/NEWS.md index d77f3db2..6cb33c88 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,7 @@ * Fix shapefile export for non-linestring results starting with NULLs (#111) * Fix missing .prj in shapefile export (#110) * Improve recognition of non-standard field types names by db lookup (#112) +* Upgrade node-pg dependency to 2.6.2 1.5.4 - 2013-10-01 ------------------ diff --git a/app/models/psql.js b/app/models/psql.js index 4a1ddfee..4046a5a1 100644 --- a/app/models/psql.js +++ b/app/models/psql.js @@ -176,32 +176,13 @@ var PSQL = function(user_id, db) { ); }; - // Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c me.quoteIdentifier = function(str) { - - // TODO: delegate to node-postgresl (needs node-pg 2.2.0+!) - - var escaped = '"'; - - for(var i = 0; i < str.length; i++) { - var c = str[i]; - if(c === '"') { - escaped += c + c; - } else { - escaped += c; - } - } - - escaped += '"'; - - return escaped; + return pg.Client.prototype.escapeIdentifier(str); }; -/* me.escapeLiteral = function(s) { - return this.client.escapeLiteral(s); + return pg.Client.prototype.escapeLiteral(str); }; -*/ me.query = function(sql, callback){ var that = this; diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 05314460..76ba9a37 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { - "name": "cartodb_api", - "version": "1.5.3", + "name": "cartodb_sql_api", + "version": "1.6.0", "dependencies": { "cluster2": { "version": "0.3.5-cdb02", @@ -295,7 +295,7 @@ } }, "pg": { - "version": "1.2.0", + "version": "2.6.2", "dependencies": { "buffer-writer": { "version": "1.0.0", diff --git a/package.json b/package.json index 9c9fe9ff..1ceb9940 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "express": "~2.5.11", "underscore" : "~1.3.3", "underscore.string": "~1.1.6", - "pg": "~1.2.0", + "pg": "~2.6.2", "express": "~2.5.11", "generic-pool": "~2.0.2", "redis": "0.7.1",