All Projects → jdonaldson → postgrehx

jdonaldson / postgrehx

Licence: other
An implementation of the postgres wire protocol in Haxe

Programming Languages

haxe
709 projects

Postgrehx

Postgrehx is a pure Haxe implementation of the Postgres wire protocol.

This library is in an early alpha state, but is passing some basic tests.

Build Status

Here's the current TODO:

  1. automatic decoding of types other than numbers, booleans, strings, and timestamps.
  2. fill out the rest of the haxe sys.db.Connection interface
  3. properly handle the async message flow from postgres

DONE:

  1. MD5 and basic authentication (thanks Juraj!)

Usage

class Test {
	static function main() {
		var con = sys.db.Postgres.connect({
			host : "localhost",
			user : "jdonaldson",
			pass : "jdonaldson",
			database : "scratch"
		});
		trace(con.dbName() + " is the value for con.dbName()");
		// con.request('SELECT NOW() AS "theTime"');
		var res = con.request("
			SELECT table_schema,table_name
			FROM information_schema.tables
			ORDER BY table_schema,table_name;
			");
		for (r in res) trace(r);

		con.close();
		return;
	}
}

Running Tests

If you want to run the tests, execute the tools/create_db.sh bash script that contains the database, pass, and test user for the tests. To get rid of it, run the tools/destroy_db.sh script.

Postgrehx should work with most modern versions of PGSQL (version 8 or later). The tests are intended to run against version 9.3 or later, as they test the latest json indexing methods.

Acknowledgments

Thanks to theRemix and back2Dos for contributing test cases and fixes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].