Created
January 18, 2011 10:00
Revisions
-
xrd revised this gist
Jan 18, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ var pg = require('pg'); var sys = require( 'sys' ); var cs = "postgres://blarg:blarg@localhost/blarg-upload-development"; -
xrd created this gist
Jan 18, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ ar pg = require('pg'); var sys = require( 'sys' ); var cs = "postgres://blarg:blarg@localhost/blarg-upload-development"; try { pg.connect( cs, function( err, client ) { var filename = "foobar"; var directoryId = 12345; try { client.query("INSERT INTO uploads(filename, directory_id) VALUES($1, $2)", [filename, directoryId]); } catch( e ) { sys.puts( "Error: " + e.inspect ); } } ); } catch( err2 ) { sys.puts( "Error!: " + err2.inspect ); }