insertBySQL

Description

Inserts features in a table by performing a query on a table using an MI SQL Update command string with an optional commitInterval. In some cases the table will need a primary key column, depending on the data provider and the query. See the MapInfo SQL Language Reference for detailed information on MI SQL commands and functions.

Note: You must have View permissions on the named table as well as Create/Modify/Delete permissions on the named table's associated dataset to perform insert, update, and delete operations on writable tables. See Users and Roles in the Administration section for more information.
Note: Insert is supported on PostGIS, Oracle, SQL Server, GeoPackage, and generic JDBC tables. It also supported on MapInfo native TAB and extended native TAB (NativeX) files on Windows operating systems only (the commitInterval is ignored). Named tables with composite primary keys are not writable.

ACL Authorization Flow

To insert features in a named table, the user (or the role they belong to) needs both EXECUTE and CREATE permission on the Named table.

Messages

The following table lists the request and response messages for the insertBySQL operation.

Click on a message name to get more information about the message.

Message Description
InsertBySQLRequest The request message for the insertBySQL operation.
InsertBySQLResponse The response message for the insertBySQL operation.

Example

Example request for inserting features in a table using the MI SQL Insert command with bound parameters and a commitInterval:

<InsertBySQLRequest
              xmlns:ns2="http://www.mapinfo.com/midev/service/featurecollection/v1"
              xmlns:ns3="http://www.mapinfo.com/midev/service/style/v1"
              xmlns:ns4="http://www.mapinfo.com/midev/service/geometries/v1"
              xmlns:ns5="http://www.mapinfo.com/midev/service/table/v1"
               xmlns:ns6="http://www.mapinfo.com/midev/service/feature/v1">
       <ns6:SQL>"INSERT INTO "\NameTable" (COL1, COL2, COL3, OBJ) VALUES 
		(@param1,'New Feature1', 20, MI_Line('-92.2,13.1,-87.4,16.6','epsg:4326')), 
		(@param2, 'New Feature2', 30, MI_Line('-92,13,-87,16','epsg:4326')), 
		(@param3, 'New Feature3', 40, MI_Line('-92,13,-87,16','epsg:4326')) 
		commit_interval 1</ns6:SQL>
       <ns6:BoundParameterList>
              <ns6:BoundParameter name="param1">
                      <ns6:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
				xsi:type="ns2:IntValue">
                              <ns2:Value>10</ns2:Value>
                      </ns6:Value>
              </ns6:BoundParameter>
                   <ns6:BoundParameter name="param2">
                      <ns6:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
				xsi:type="ns2:IntValue">
                              <ns2:Value>20</ns2:Value>
                      </ns6:Value>
              </ns6:BoundParameter> 
     <ns6:BoundParameter name="param3">
                      <ns6:Value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
				xsi:type="ns2:IntValue">
                              <ns2:Value>30</ns2:Value>
                      </ns6:Value>
              </ns6:BoundParameter> 
       </ns6:BoundParameterList>
</InsertBySQLRequest>