Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- con = this.pool.getConnection();
- ps = con.createStatement();
- // ps = con.prepareStatement("INSERT INTO users(login,password)VALUES(?,?)", );
- Assert.assertNotNull("could not create prepared statement", ps);
- // ps.setString(1, "benutzerasdfnameasdf");
- // ps.setString(2, "passwort");
- ps.executeUpdate("INSERT INTO users(login,password)VALUES('die henne','fick')",
- Statement.RETURN_GENERATED_KEYS);
- rs = ps.getGeneratedKeys();
- Assert.assertNotNull("could not execure query", rs);
- int key;
- Assert.assertTrue("there wherent any generated keys..", rs.next());
- if(ps.getGeneratedKeys().next())
- {
- System.out.print(ps.getGeneratedKeys().getInt(1));
- }
- else
- {
- System.out.println("jo");
- }
- Assert.assertFalse(rs.next());
Add Comment
Please, Sign In to add comment