Created
January 18, 2011 10:00
-
-
Save xrd/784242 to your computer and use it in GitHub Desktop.
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 characters
var 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 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment