edu.jhu.tmaj.database.sql
Class InsertSQL
java.lang.Object
edu.jhu.tmaj.database.sql.ModifySQL
edu.jhu.tmaj.database.sql.AbstractModifySQL
edu.jhu.tmaj.database.sql.InsertSQL
- All Implemented Interfaces:
- SQL
public final class InsertSQL
- extends AbstractModifySQL
- implements SQL
Represents an Insert SQL statement.
Example on how to use this class:
To create the following SQL statement:
INSERT INTO Employees (FirstName, LastName, IsMarried, OfficeNumber) VALUES ('John', 'Smith', 0,
25011)
use this code:
InsertSQL insertSQL = InsertSQL.getInstance("Employees","EmployeeID");
insertSQL.add("FirstName", "John");
insertSQL.add("LastName", "Smith");
insertSQL.add("IsMarried", true);
insertSQL.add("OfficeNumber", 25011);
Methods inherited from class edu.jhu.tmaj.database.sql.AbstractModifySQL |
addBoolean, addDate, addDateTime, addDouble, addFloat, addInputLog, addInteger, addLiteralValue, addLong, addString, getSetSQLValues |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
getInstance
public static InsertSQL getInstance(java.lang.String tableName,
java.lang.String primaryKeyName)
getInstance
public static InsertSQL getInstance(java.lang.String tableName)
- Gets an InsertSQL statement for a table whose primary key name is ID. (Naming the primary
key of a table ID is a standard often used.)
getPrimaryKeyName
public java.lang.String getPrimaryKeyName()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object