To insert a row, first create a member of the class associated with the table,
and then use ODBCConnection.Insert
to insert it:
local timestamp;
local record;
record = new (tableclass);
timestamp = localtime (clock());
timestamp = format ("%d-%02d-%02d %02d:%02d:%02d",
timestamp.year + 1900, timestamp.mon + 1,
timestamp.mday, timestamp.hour, timestamp.min,
timestamp.sec);
record.ptname = "point name";
record.ptvalue = point_value;
record.pttimestamp = timestamp;
record.ptquality = point_quality;
.conn.Insert (record);This code creates a record to be inserted, assigns a value to each column in
the record, and then inserts it into the database. The Gamma engine will
attempt to convert the values in each column to the type required by the
database. If an error occurs, the Insert method will throw
an error that can be handled by a try/catch block.
You can also insert rows by constructing your own SQL statement and submitting
it using the ODBCConnection.QueryAndStore
method.