Skip to content

Instantly share code, notes, and snippets.

@slaykovsky
Created February 13, 2017 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaykovsky/e51d271ee4d9b19b20edd2f748aeaed4 to your computer and use it in GitHub Desktop.
Save slaykovsky/e51d271ee4d9b19b20edd2f748aeaed4 to your computer and use it in GitHub Desktop.
curl -X POST -H "Content-Type: application/json" -d '{"machine": "host", "name": "test", "size": "1", "run": "2", "result": "23.3"}' http://localhost:8080/api/testRuns
router.post("/api/testRuns").handler(ctx -> {
HttpServerResponse response = ctx.response();
SQLConnection conn = ctx.get("conn");
JsonObject body = ctx.getBodyAsJson();
conn.updateWithParams("INSERT INTO testruns VALUES (?, ?, ?, ?, ?)",
new JsonArray()
.add(body.getString("machine"))
.add(body.getString("name"))
.add(body.getInteger("size"))
.add(body.getInteger("run"))
.add(body.getFloat("result")), query -> {
if (query.failed()) {
response.setStatusCode(500).end();
} else {
response.end();
}
});
});
pgrapher_1 | MLog initialization issue: slf4j found no binding or threatened to use its (dangerously silent) NOPLogger. We consider the slf4j library not found.
pgrapher_1 | Feb 13, 2017 12:42:49 PM com.mchange.v2.log.MLog
pgrapher_1 | INFO: MLog clients using java 1.4+ standard logging.
pgrapher_1 | Feb 13, 2017 12:42:49 PM com.mchange.v2.c3p0.C3P0Registry
pgrapher_1 | INFO: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
pgrapher_1 | Feb 13, 2017 12:42:50 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource
pgrapher_1 | INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> 1bqrg1v9mfecdr4ov979j|3d23eb45, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.postgresql.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceSynchronousCheckins -> false, forceUseNamedDriverClass -> false, identityToken -> 1bqrg1v9mfecdr4ov979j|3d23eb45, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:postgresql://database:5432/pgrapher, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment