Insert Records
After you have created a datastore table, you can add records to it:
DatastoreRecord newRecord = new DatastoreRecord(); newRecord.setString("Reference", "C:\\data\\file1.txt"); newRecord.setString("LastModified", "2013/07/30 14:36:00"); datastore.recordInsert("Documents", newRecord);
This example creates a record, sets values for each column, and inserts the record into the table created in Create Tables. setString
, setLong
, and setBoolean
methods on the record.
Although you can set any fields you like in the Record, an exception is thrown from the recordInsert
method if you try to set fields that are not in the table.