// Path: squidb/src/com/yahoo/squidb/sql/TableStatement.java
// public enum ConflictAlgorithm {
//     /**
//      * No conflict algorithm specified.
//      */
//     NONE,
//     /**
//      * Aborts the command and reverts any changes made within the same transaction up to this point.
//      */
//     ROLLBACK,
//     /**
//      * Aborts the command and reverts any changes made by this command up to this point. Changes made by other
//      * commands in the same transaction as this command and which have already completed are preserved.
//      */
//     ABORT,
//     /**
//      * Aborts the command, but any changes to the database that the command made prior to encountering the
//      * constraint violation are preserved.
//      */
//     FAIL,
//     /**
//      * When a constraint violation occurs, the one row that contains the constraint violation is not inserted or
//      * changed. Other rows before and after the row that contained the constraint violation continue to be inserted
//      * or updated normally.
//      */
//     IGNORE,
//     /**
//      * When a UNIQUE constraint violation occurs, the pre-existing row that caused the constraint violation is
//      * removed prior to inserting or updating the current row.
//      */
//     REPLACE
// }


import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.TableStatement.ConflictAlgorithm;
import com.yahoo.squidb.test.Constants;
import com.yahoo.squidb.test.DatabaseTestCase;
import com.yahoo.squidb.test.TestModel;
import com.yahoo.squidb.test.Thing;
    public void testInsertWithValues() {
        final String fname = "Jack";
        final String lname = "Sparrow";

        // check preconditions
        // last name is unique
        Criterion lastNameSparrow = TestModel.LAST_NAME.eqCaseInsensitive(lname);
        TestModel shouldBeNull = database.fetchByCriterion(TestModel.class, lastNameSparrow, TestModel.PROPERTIES);
        assertNull(shouldBeNull);

        // insert into testModels (firstName, lastName) values ('Jack', 'Sparrow');
        Insert insert = Insert.into(TestModel.TABLE).columns(TestModel.FIRST_NAME, TestModel.LAST_NAME).values(fname,
                lname);
        CompiledStatement compiled = insert.compile(database.getCompileContext());

        verifyCompiledSqlArgs(compiled, 2, fname, lname);

        assertEquals(2, database.insert(insert));

        TestModel shouldNotBeNull = database.fetchByCriterion(TestModel.class, lastNameSparrow, TestModel.PROPERTIES);
        assertNotNull(shouldNotBeNull);
        assertEquals(fname, shouldNotBeNull.getFirstName());
        assertEquals(lname, shouldNotBeNull.getLastName());
    }

    public void testInsertMultipleValues() {
        testForMinVersionCode(Insert.SQLITE_VERSION_MULTI_ROW_INSERT, new Runnable() {
            @Override
            public void run() {
                final String fname1 = "Alan";
// Path: squidb/src/com/yahoo/squidb/sql/TableStatement.java
// public enum ConflictAlgorithm {
//     /**
//      * No conflict algorithm specified.
//      */
//     NONE,
//     /**
//      * Aborts the command and reverts any changes made within the same transaction up to this point.
//      */
//     ROLLBACK,
//     /**
//      * Aborts the command and reverts any changes made by this command up to this point. Changes made by other
//      * commands in the same transaction as this command and which have already completed are preserved.
//      */
//     ABORT,
//     /**
//      * Aborts the command, but any changes to the database that the command made prior to encountering the
//      * constraint violation are preserved.
//      */
//     FAIL,
//     /**
//      * When a constraint violation occurs, the one row that contains the constraint violation is not inserted or
//      * changed. Other rows before and after the row that contained the constraint violation continue to be inserted
//      * or updated normally.
//      */
//     IGNORE,
//     /**
//      * When a UNIQUE constraint violation occurs, the pre-existing row that caused the constraint violation is
//      * removed prior to inserting or updating the current row.
//      */
//     REPLACE
// }


// Path: squidb-tests/src/com/yahoo/squidb/sql/InsertTest.java
import com.yahoo.squidb.data.SquidCursor;
import com.yahoo.squidb.sql.TableStatement.ConflictAlgorithm;
import com.yahoo.squidb.test.Constants;
import com.yahoo.squidb.test.DatabaseTestCase;
import com.yahoo.squidb.test.TestModel;
import com.yahoo.squidb.test.Thing;

    public void testInsertWithValues() {
        final String fname = "Jack";
        final String lname = "Sparrow";

        // check preconditions
        // last name is unique
        Criterion lastNameSparrow = TestModel.LAST_NAME.eqCaseInsensitive(lname);
        TestModel shouldBeNull = database.fetchByCriterion(TestModel.class, lastNameSparrow, TestModel.PROPERTIES);
        assertNull(shouldBeNull);

        // insert into testModels (firstName, lastName) values ('Jack', 'Sparrow');
        Insert insert = Insert.into(TestModel.TABLE).columns(TestModel.FIRST_NAME, TestModel.LAST_NAME).values(fname,
                lname);
        CompiledStatement compiled = insert.compile(database.getCompileContext());

        verifyCompiledSqlArgs(compiled, 2, fname, lname);

        assertEquals(2, database.insert(insert));

        TestModel shouldNotBeNull = database.fetchByCriterion(TestModel.class, lastNameSparrow, TestModel.PROPERTIES);
        assertNotNull(shouldNotBeNull);
        assertEquals(fname, shouldNotBeNull.getFirstName());
        assertEquals(lname, shouldNotBeNull.getLastName());
    }

    public void testInsertMultipleValues() {
        testForMinVersionCode(Insert.SQLITE_VERSION_MULTI_ROW_INSERT, new Runnable() {
            @Override
            public void run() {
                final String fname1 = "Alan";
                final String lname1 = "Turing";