UpdateRow - Maple Help

Online Help

All Products    Maple    MapleSim


Result

  

UpdateRow

  

send row updates to the database

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

result:-UpdateRow( )

Parameters

result

-

Result module

Description

• 

UpdateRow sends the row changes made by UpdateData to the database.

• 

To update a row, set the new values by calling UpdateData and then submit these updates by calling UpdateRow.  Changing the current row before calling UpdateRow discards any values set with UpdateData.

• 

Maple can automatically determine the type of the column and convert data; however, this requires querying the type of the column.  To avoid this overhead the type can be specified using an explicit cast. For more information, see conversions.

• 

An element can be set to SQL NULL by passing 'SQLNULL' for data.

• 

Not all Result modules can be updated.  Only Result modules representing tables containing data from a single table (no joins) and a column of primary keys are guaranteed to be updatable (assuming the JDBC driver is standards-compliant). Particular JDBC Drivers and databases may allow a wider range of updatable tables and thus Result modules.

• 

Updates made to a row may not be visible in the current Result module.  Issuing another query may be necessary to see the changes.

Examples

Create a Result to be updated.

driverDatabaseLoadDriver:

conndriver:-OpenConnectionurl,name,pass:resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals:res:-Next

true

(1)

Get the current values.

res:-GetData2

fish

(2)

res:-GetData3

100

(3)

res:-GetData4

0.0100000000000000002

(4)

Set the update values.

res:-UpdateData2,chicken;res:-UpdateData3,6;res:-UpdateData4,2.5

The new values are not sent to the database yet.

res:-GetData2

fish

(5)

res:-GetData3

100

(6)

res:-GetData4

0.0100000000000000002

(7)

Update the row.

res:-UpdateRow

Check the values.

resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals:res:-Next

true

(8)

res:-GetData2

chicken

(9)

res:-GetData3

6

(10)

res:-GetData4

2.50000000000000000

(11)

See Also

Database

Database[Result]

Database[Result][GotoRow]

Database[Result][Last]

Database[Result][Next]

Database[Result][Previous]

Database[Result][UpdateData]

Database[usage]