Result - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Database Package : Result : Database/Result/InsertRow

Result

  

InsertRow

  

move the cursor to the given row

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

result:-InsertRow( optsIndex )

result:-InsertRow( optsEquation )

Parameters

result

-

Result module

optsIndex

-

(optional) data to insert into the row

optsEquation

-

(optional) equations of the form option=value where option is the name of a column

Description

• 

InsertRow allows a new row of data to be inserted in to the table. InsertRow accepts arguments in two different formats.

  

The index form inserts the first argument to InsertRow into the first column of the table, the second argument into the second column, and so forth. If there are more columns than arguments specified, the unspecified columns are given SQL NULL as values.

  

The equations form inserts value into the row named option. Any unassigned columns are assigned a value of SQL NULL.

• 

Maple can automatically determine the type of a column and convert the input argument; 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.

• 

When using the index form of InsertRow, you can set an element to SQL NULL by passing 'SQLNULL' as the argument corresponding to that column.

• 

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.  Particular JDBC Drivers and databases may allow a wider range of updatable tables and thus Result modules.

• 

InsertRow does not return anything.

Examples

Create a Result module.  In this case, id is a Primary Key.

driverDatabase[LoadDriver]:

conndriver:-OpenConnectionurl,name,pass:resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals WHERE id > 10:res:-ToMapleoutput='Array'

(1)

res:-InsertRow11,chicken,15,2.1;resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals WHERE id > 10:res:-ToMapleoutput='Array'

11chicken152.10000000000000008

(2)

res:-InsertRowid=12,number=513,name=cow;resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals WHERE id > 10:res:-ToMapleoutput='Array'

11chicken152.1000000000000000812cow513NULL

(3)

res:-InsertRow13,'SQLNULL',7,0.7;resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals WHERE id > 10:res:-ToMapleoutput='Array'

11chicken152.1000000000000000812cow513NULL13NULL70.699999999999999956

(4)

res:-InsertRowname=boar,mass=13,id=14;resconn:-ExecuteQuerySELECT id,name,number,mass FROM animals WHERE id 10:res:-ToMapleoutput='Array'

11chicken152.1000000000000000812cow513NULL13NULL70.69999999999999995614boarNULL0.333333333333332982

(5)

See Also

Database

Database[Connection][ExecuteQuery]

Database[Result]

Database[Result][DeleteRow]

Database[Result][ToMaple]

Database[Result][UpdateData]

Database[Result][UpdateRow]

Database[usage]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam