Tabnine Logo
InsertGenKeysOp$Int.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.novarto.sanedbc.core.ops.InsertGenKeysOp$Int
constructor

Best Java code snippets using com.novarto.sanedbc.core.ops.InsertGenKeysOp$Int.<init> (Showing top 2 results out of 315)

origin: novarto-oss/sane-dbc

public static DB<Integer> insertStuffGetKey(String description)
{
  /*
    An InsertGenKeysOp is the same as an UpdateOp, only that it expects an auto-generated key to be present
    after executing the update, and returns it as the result.
    InsertGenKeysOp.Int is a specialization which expects an Integer key
   */
  return new InsertGenKeysOp.Int(
      "INSERT INTO STUFF(DESCRIPTION) VALUES(?)",
      // you can see that the binder is the same as in the previous operation.
      // in that case it is good practice to extract it as a static final field of your module
      ps -> ps.setString(1, description)
  );
}
origin: novarto-oss/sane-dbc

@Test
public void insertGenKeys()
{
  Integer id = DB.transact(new InsertGenKeysOp.Int(
      "INSERT INTO MySqlTest_IDS(DUMMY) VALUES (?)",
      ps -> ps.setString(1, "a")));
  assertThat(id, is(notNullValue()));
  String str = DB.submit(DbOps
      .unique(new SelectOp.List<>("SELECT DUMMY FROM MySqlTest_IDS WHERE ID=?", ps -> ps.setInt(1, id),
          rs -> rs.getString(1)))).some();
  assertThat(str, is("a"));
}
com.novarto.sanedbc.core.opsInsertGenKeysOp$Int<init>

Popular methods of InsertGenKeysOp$Int

    Popular in Java

    • Start an intent from android
    • orElseThrow (Optional)
      Return the contained value, if present, otherwise throw an exception to be created by the provided s
    • getApplicationContext (Context)
    • requestLocationUpdates (LocationManager)
    • RandomAccessFile (java.io)
      Allows reading from and writing to a file in a random-access manner. This is different from the uni-
    • UUID (java.util)
      UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
    • JPanel (javax.swing)
    • Response (javax.ws.rs.core)
      Defines the contract between a returned instance and the runtime when an application needs to provid
    • IsNull (org.hamcrest.core)
      Is the value null?
    • Location (org.springframework.beans.factory.parsing)
      Class that models an arbitrary location in a Resource.Typically used to track the location of proble
    • Github Copilot alternatives
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now