From 63333e52008da8d7e9ac3608764565b7af88aa2c Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Sat, 27 Jan 2018 16:03:15 -0600 Subject: [PATCH 1/6] Adding database-js as a dev dependency --- package-lock.json | 6 ++++++ package.json | 3 +++ 2 files changed, 9 insertions(+) diff --git a/package-lock.json b/package-lock.json index 77aa333..867df13 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,12 @@ "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-1.0.1.tgz", "integrity": "sha1-Iqk2kB4wKa/NdUfrRIfOtpejvwg=" }, + "database-js": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/database-js/-/database-js-3.0.2.tgz", + "integrity": "sha512-YoCw6q95dwzbD/3PlZm6+CcxJY8QbEvbEt5bRCUVdskyT5j97Ofjt77in6GpCbxDUbKBZ7eGzlyJ7pLPH7raAg==", + "dev": true + }, "packet-reader": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/packet-reader/-/packet-reader-0.3.1.tgz", diff --git a/package.json b/package.json index cf670a4..8acacad 100644 --- a/package.json +++ b/package.json @@ -22,5 +22,8 @@ "homepage": "https://github.com/mlaanderson/database-js-postgres#readme", "dependencies": { "pg": "^7.0.2" + }, + "devDependencies": { + "database-js": "^3.0.2" } } From 94ddb12a679cfcc9c6cdf62304467e0b22ec7477 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Sat, 27 Jan 2018 16:05:23 -0600 Subject: [PATCH 2/6] 1.1.2 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 867df13..2cc9533 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "database-js-postgres", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8acacad..1c78f2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "database-js-postgres", - "version": "1.1.1", + "version": "1.1.2", "description": "Database-js wrapper for PostgreSQL", "main": "index.js", "scripts": { From 53a461aa05485873447e8c178e7309f3e99d2267 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Fri, 2 Feb 2018 11:44:13 -0600 Subject: [PATCH 3/6] Updating test.js to be similar to other database-js-* drivers --- test.js | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test.js b/test.js index cca183f..2b9f551 100644 --- a/test.js +++ b/test.js @@ -8,26 +8,26 @@ var Connection = Postgres.open({ Database: 'test' }); -var promises = []; -promises.push(Connection.execute('DROP TABLE IF EXISTS test1; CREATE TABLE test1 (key character varying(255), value character varying(1024));').then(() => { - promises.push(Connection.execute("INSERT INTO test1 VALUES('name', 'Michael Anderson');").then(() => { - promises.push(Connection.query("SELECT * FROM test1 WHERE key = 'name';").then(data => { - if (data.length != 1) { - console.error('Invalid data returned'); - Connection.execute('DROP TABLE test1;').then(() => { +function handleError(error) { + console.log("ERROR:", error); + process.exit(1); +} + +Connection.execute('DROP TABLE IF EXISTS test1;').then(() => { + Connection.execute('CREATE TABLE test1 (fl_name varchar(32), fl_value varchar(32));').then(() => { + Connection.execute("INSERT INTO test1 VALUES('name', 'Michael Anderson');").then(() => { + Connection.query("SELECT * FROM test1 WHERE fl_name = 'name';").then(data => { + if (data.length != 1) { + return handleError(new Error("Invalid data returned")); + } + console.log(data); + Connection.execute('DROP TABLE IF EXISTS test1;').then(() => { Connection.close().then(() => { - process.exit(1); - }); - }) - } - })); - })); -})); + process.exit(0); + }).catch(handleError); + }).catch(handleError); + }).catch(handleError); + }).catch(handleError); + }).catch(handleError); +}).catch(handleError); -Promise.all(promises).then(() => { - Connection.execute('DROP TABLE IF EXISTS test1;').then(() => { - Connection.close().then(() => { - process.exit(0); - }); - }); -}); From 77249761a205066037d22f6b7407b794bad97da0 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Fri, 2 Feb 2018 11:54:27 -0600 Subject: [PATCH 4/6] Adding in node v9 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ec15773..37111f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - "9" - "8" - "7" - "6" From 241d657f905f7f38113e230c84b4f7c14b234a65 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Mon, 16 Jul 2018 13:50:05 -0500 Subject: [PATCH 5/6] Fixed left over mysqlp reference from readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8833436..50c3bfe 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Database-js wrapper for PostgreSQL ## About -Database-js-mysql is a wrapper around the [node-postgres](https://github.com/brianc/node-postgres) package by Brian Carlson. It is intended to be used with the [database-js](https://github.com/mlaanderson/database-js) package. However it can also be used in stand alone mode. The only reason to do that would be to use [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). +Database-js-postgres is a wrapper around the [node-postgres](https://github.com/brianc/node-postgres) package by Brian Carlson. It is intended to be used with the [database-js](https://github.com/mlaanderson/database-js) package. However it can also be used in stand alone mode. The only reason to do that would be to use [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). ## Usage ### Stand Alone ~~~~ From a6f3eaeccfc79b9d85273d01587c4e3a090e47e8 Mon Sep 17 00:00:00 2001 From: Zachary-D Date: Mon, 25 Oct 2021 15:42:35 -0400 Subject: [PATCH 6/6] Bumped pg version to ^8.5.1 This should resolve a compatibility issue with older pg versions and node 14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c78f2a..e7f86ca 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ }, "homepage": "https://github.com/mlaanderson/database-js-postgres#readme", "dependencies": { - "pg": "^7.0.2" + "pg": "^8.5.1" }, "devDependencies": { "database-js": "^3.0.2"