io.vertx.sqlclient.PropertyKind Java Examples

The following examples show how to use io.vertx.sqlclient.PropertyKind. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqlClientConnection.java    From hibernate-reactive with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Loads MySQLClient.LAST_INSERTED_ID via reflection to avoid a hard
 * dependency on the MySQL driver
 */
@SuppressWarnings("unchecked")
private static PropertyKind<Long> getMySqlLastInsertedId() {
    if (mySqlLastInsertedId == null) {
           try {
               Class<?> MySQLClient = Class.forName( "io.vertx.mysqlclient.MySQLClient" );
               mySqlLastInsertedId = (PropertyKind<Long>) MySQLClient.getField( "LAST_INSERTED_ID" ).get( null );
           } catch (ClassNotFoundException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException | SecurityException e) {
               throw new RuntimeException( "Unable to obtain MySQLClient.LAST_INSERTED_ID field", e );
           }
       }
       return mySqlLastInsertedId;
   }
 
Example #2
Source File: QueryResultBuilder.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
@Override
public <V> void addProperty(PropertyKind<V> property, V value) {
  R r = this.current;
  if (r != null) {
    if (r.properties == null) {
      // lazy init
      r.properties = new HashMap<>();
    }
    r.properties.put(property, value);
  }
}
 
Example #3
Source File: SqlResultTest.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testNullProperties() {
  RowSetImpl rowSet = new RowSetImpl();
  rowSet.properties = null;
  PropertyKind<String> propertyKind = () -> String.class;
  Assert.assertNull(rowSet.property(propertyKind));
}
 
Example #4
Source File: SqlResultTest.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testPropertyKindNullType() {
  RowSetImpl rowSet = new RowSetImpl();
  rowSet.properties = new HashMap<>();
  PropertyKind<String> nullTypePropertyKind = () -> null;
  try {
    rowSet.property(nullTypePropertyKind);
  } catch (NullPointerException ignored) {
    // NPE
  }
}
 
Example #5
Source File: SqlResultTest.java    From vertx-sql-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testUnknownPropertyKind() {
  RowSetImpl rowSet = new RowSetImpl();
  PropertyKind<Integer> knownPropertyKind = () -> Integer.class;
  PropertyKind<String> unknownPropertyKind = () -> String.class;
  rowSet.properties = new HashMap<>();
  rowSet.properties.put(knownPropertyKind, 1234);

  Assert.assertEquals(Integer.valueOf(1234), rowSet.property(knownPropertyKind));
  Assert.assertNull(rowSet.property(unknownPropertyKind));
}
 
Example #6
Source File: QueryResultHandler.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
public <V> void addProperty(PropertyKind<V> property, V value) {
}
 
Example #7
Source File: LocalRowSet.java    From raml-module-builder with Apache License 2.0 4 votes vote down vote up
@Override
public <V> V property(PropertyKind<V> propertyKind) {
  return null;
}
 
Example #8
Source File: QueryResultHandler.java    From vertx-sql-client with Apache License 2.0 votes vote down vote up
<V> void addProperty(PropertyKind<V> property, V value);