<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator">Salesforce Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (5)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >For any reason you need to use a different version of API than &quot;22&quot;, then you can provide the new translator and resource-adapter combination for that API. For your convenience we provided a template project [https://github.com/teiid/salesforce] that you can build and deploy into Teiid system for the new version of the API. <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">If you are using Teiid Embedded, then you could simply choose to replace the kitted salesforce jars with a later version.  Up to version v34 is known to be compatible. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{info} <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Salesforce does not provide the same set of functionality as a relational database. For example, Salesforce does not support arbitrary joins between tables. However, working in combination with the Teiid Query Planner, the Salesforce connector supports nearly all of the SQL syntax supported by the Teiid. <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">The Salesforce Connector executes SQL commands by “pushing down” the command to Salesforce whenever possible, based on the supported capabilities. Teiid will automatically provide additional database functionality when the Salesforce Connector does not        explicitly provide support for a given SQL construct. In these cases, the SQL construct cannot be “pushed down” to the data source, so it will be evaluated in Teiid, in order to ensure that the operation is performed. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The Salesforce Connector executes SQL commands by &quot;pushing down&quot; the command to Salesforce whenever possible, based on the supported capabilities. Teiid will automatically provide additional database functionality when the Salesforce Connector does not explicitly provide support for a given SQL construct. In cases where certain SQL capabilities cannot be pushed down to Salesforce, Teiid will push down the capabilities that are supported, and fetch a set of data from Salesforce. Then, Teiid will evaluate the additional capabilities, creating a subset of the original data set. Finally, Teiid will pass the result to the client. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">In cases where certain SQL capabilities cannot be pushed down to Salesforce, Teiid will push down the capabilities that are supported, and fetch a set of data from Salesforce. Then, Teiid will evaluate the additional capabilities, creating a subset of the original data set. Finally, Teiid will pass the result to the client. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">If you are issuing queries with a group by clause and receive an error for salesforce related to queryMore not being supported, you may either add limits or set the execution property SupportsGroupBy to false. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>{code:lang=SQL} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="SalesforceTranslator-SalesforceTranslator"></a>Salesforce Translator</h1>

<p>The Salesforce translator, known by the type name <em>salesforce</em> supports the SELECT, DELETE, INSERT and UPDATE operations against a Salesforce.com account. It is designed for use with the Teiid Salesforce resource adapter.</p>

<p>Execution Properties</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> ModelAuditFeilds </td>
<td class='confluenceTd'> Audit Model Fields </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> MaxBulkInsertBatchSize </td>
<td class='confluenceTd'> Batch Size to use to insert bulk inserts </td>
<td class='confluenceTd'> 2048 </td>
</tr>
<tr>
<td class='confluenceTd'> SupportsGroupBy </td>
<td class='confluenceTd'> Supports Group By Pushdown. Set to false to have Teiid process group by aggregations, such as those returning more than 2000 rows which error in SOQL. </td>
<td class='confluenceTd'> true </td>
</tr>
</tbody></table>
</div>


<p>The Salesforce translator can import metadata.</p>

<h4><a name="SalesforceTranslator-ImportProperties"></a>Import Properties</h4>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'>Property Name</th>
<th class='confluenceTh'>Description</th>
<th class='confluenceTh'>Required</th>
<th class='confluenceTh'>Default</th>
</tr>
<tr>
<td class='confluenceTd'>NormalizeNames</td>
<td class='confluenceTd'>If the importer should attempt to modify the object/field names so that they can be used unquoted.</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>true</td>
</tr>
<tr>
<td class='confluenceTd'>excludeTables</td>
<td class='confluenceTd'>A case-insensitive regular expression that when matched against a table name will exclude it from import.  Applied after table names are retrieved.  Use a negative look-ahead (?!&lt;inclusion pattern&gt;).* to act as an inclusion filter.</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>n/a</td>
</tr>
<tr>
<td class='confluenceTd'>includeTables</td>
<td class='confluenceTd'>A case-insensitive regular expression that when matched against a table name will be included during import.  Applied after table names are retrieved from source.</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>n/a</td>
</tr>
<tr>
<td class='confluenceTd'>importStatstics</td>
<td class='confluenceTd'>Retrieves cardinalities during import using the REST API explain plan feature.</td>
<td class='confluenceTd'>false</td>
<td class='confluenceTd'>false</td>
</tr>
</tbody></table>
</div>


<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>When both <em>includeTables</em> and <em>excludeTables patterns are present during the import, the _includeTables</em> pattern matched first, then the <em>excludePatterns</em> will be applied.</td></tr></table></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Teiid translator uses Salesforce Partner API libraries to access the Salesforce system. By default Teiid uses Partner API version "22". Metadata retrieval using the translator and execution of queries against Salesforce using this metadata are <b>strongly</b> dependent upon the API version that has been used. It is required that you use same API versions for both Metadata retrieval and query execution. For this reason if you have older VDBS then you either need to re-import the metadata or keep using the default version.

<p>For any reason you need to use a different version of API than "22", then you can provide the new translator and resource-adapter combination for that API. For your convenience we provided a template project <a href="https://github.com/teiid/salesforce" class="external-link" rel="nofollow">https://github.com/teiid/salesforce</a> that you can build and deploy into Teiid system for the new version of the API.</p>

<p>If you are using Teiid Embedded, then you could simply choose to replace the kitted salesforce jars with a later version.  Up to version v34 is known to be compatible.</p></td></tr></table></div>

<h3><a name="SalesforceTranslator-SQLProcessing"></a>SQL Processing</h3>

<p>Salesforce does not provide the same set of functionality as a relational database. For example, Salesforce does not support arbitrary joins between tables. However, working in combination with the Teiid Query Planner, the Salesforce connector supports nearly all of the SQL syntax supported by the Teiid.</p>

<p>The Salesforce Connector executes SQL commands by "pushing down" the command to Salesforce whenever possible, based on the supported capabilities. Teiid will automatically provide additional database functionality when the Salesforce Connector does not explicitly provide support for a given SQL construct. In cases where certain SQL capabilities cannot be pushed down to Salesforce, Teiid will push down the capabilities that are supported, and fetch a set of data from Salesforce. Then, Teiid will evaluate the additional capabilities, creating a subset of the original data set. Finally, Teiid will pass the result to the client.</p>

<p>If you are issuing queries with a group by clause and receive an error for salesforce related to queryMore not being supported, you may either add limits or set the execution property SupportsGroupBy to false.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT sum(Reports) FROM Supervisor where Division = 'customer support';
</pre>
</div></div>

<p>Neither Salesforce nor the Salesforce Connector support the sum() scalar function, but they do support CompareCriteriaEquals, so the query that is passed to Salesforce by the connector will be transformed to this query.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT Reports FROM Supervisor where Division = 'customer support';
</pre>
</div></div>

<p>The sum() scalar function will be applied by the Teiid Query Engine to the result set returned by the connector.</p>

<p>In some cases multiple calls to the Salesforce application will be made to support the SQL passed to the connector.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
DELETE From Case WHERE Status = 'Closed';
</pre>
</div></div>

<p>The API in Salesforce to delete objects only supports deleting by ID. In order to accomplish this the Salesforce connector will first execute a query to get the IDs of the correct objects, and then delete those objects. So the above DELETE command will result in the following two commands.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT ID From Case WHERE Status = 'Closed';
DELETE From Case where ID IN (&lt;result of query&gt;);
</pre>
</div></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The Salesforce API DELETE call is not expressed in SQL, but the above is an equivalent SQL expression.</td></tr></table></div>

<p>It's useful to be aware of unsupported capabilities, in order to avoid fetching large data sets from Salesforce and making you queries as performant as possible. See all Supported Capabilities.</p>

<h3><a name="SalesforceTranslator-SelectingfromMultiSelectPicklists"></a>Selecting from Multi-Select Picklists</h3>

<p>A multi-select picklist is a field type in Salesforce that can contain multiple values in a single field. Query criteria operators for fields of this type in SOQL are limited to EQ, NE, includes and excludes. The full Salesforce documentation for selecting from mullti-select picklists can be found at the following link <a href="http://www.salesforce.com/us/developer/docs/soql_sosl/Content/sforce_api_calls_soql_querying_multiselect_picklists.htm" class="external-link" rel="nofollow">Querying Mulit-select Picklists</a></p>

<p>Teiid SQL does not support the includes or excludes operators, but the Salesforce connector provides user defined function definitions for these operators that provided equivalent functionality for fields of type multi-select. The definition for the functions is:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
boolean includes(Column column, String param)
boolean excludes(Column column, String param)
</pre>
</div></div>

<p>For example, take a single multi-select picklist column called Status that contains all of these values.</p>
<ul>
        <li>current</li>
        <li>working</li>
        <li>critical</li>
</ul>


<p>For that column, all of the below are valid queries:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT * FROM Issue WHERE true = includes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = excludes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = includes (Status, 'current;working, critical' );
</pre>
</div></div>

<p>EQ and NE criteria will pass to Salesforce as supplied. For example, these queries will not be modified by the connector.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT * FROM Issue WHERE Status = 'current';
SELECT * FROM Issue WHERE Status = 'current;critical';
SELECT * FROM Issue WHERE Status != 'current;working';
</pre>
</div></div>

<h3><a name="SalesforceTranslator-SelectingAllObjects"></a>Selecting All Objects</h3>

<p>The Salesforce connector supports the calling the queryAll operation from the Salesforce API. The queryAll operation is equivalent to the query operation with the exception that it returns data about all current and deletedobjects in the system.</p>

<p>The connector determines if it will call the query or queryAll operation via reference to the isDeleted property present on each Salesforce object, and modeled as a column on each table generated by the importer. By default this value is set to False when the model is generated and thus the connector calls query. Users are free to change the value in the model to True, changing the default behaviour of the connector to be queryAll.</p>

<p>The behavior is different if isDeleted is used as a parameter in the query. If the isDeleted column is used as a parameter in the query, and the value is 'true' the connector will call queryAll.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
select * from Contact where isDeleted = true;
</pre>
</div></div>

<p>If the isDeleted column is used as a parameter in the query, and the value is 'false' the connector perform the default behavior will call query.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
select * from Contact where isDeleted = false;
</pre>
</div></div>

<h3><a name="SalesforceTranslator-SelectingUpdatedObjects"></a>Selecting Updated Objects</h3>

<p>If the option is selected when importing metadata from Salesforce, a GetUpdated procedure is generated in the model with the following structure:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
GetUpdated (ObjectName IN string,
        StartDate IN datetime,
        EndDate IN datetime,
        LatestDateCovered OUT datetime)
returns
        ID string
</pre>
</div></div>

<p>See the description of the <a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getupdated.htm" class="external-link" rel="nofollow">GetUpdated</a> operation in the Salesforce documentation for usage details.</p>

<h3><a name="SalesforceTranslator-SelectingDeletedObjects"></a>Selecting Deleted Objects</h3>

<p>If the option is selected when importing metadata from Salesforce, a GetDeleted procedure is generated in the model with the following structure:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
GetDeleted (ObjectName IN string,
        StartDate IN datetime,
        EndDate IN datetime,
        EarliestDateAvailable OUT datetime,
        LatestDateCovered OUT datetime)
returns
        ID string,
        DeletedDate datetime
</pre>
</div></div>

<p>See the description of the <a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_getdeleted.htm" class="external-link" rel="nofollow">GetDeleted</a> operation in the Salesforce documentation for usage details.</p>

<h3><a name="SalesforceTranslator-RelationshipQueries"></a>Relationship Queries</h3>

<p>Salesforce does not support joins like a relational database, but it does have support for queries that include parent-to-child or child-to-parent relationships between objects. These are termed Relationship Queries. The SalesForce connector supports Relationship Queries through Outer Join syntax.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT Account.name, Contact.Name from Contact LEFT OUTER JOIN Account
on Contact.Accountid = Account.id
</pre>
</div></div>

<p>This query shows the correct syntax to query a SalesForce model with to produce a relationship query from child to parent. It resolves to the following query to SalesForce.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT Contact.Account.Name, Contact.Name FROM Contact
</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
select Contact.Name, Account.Name from Account Left outer Join Contact
on Contact.Accountid = Account.id
</pre>
</div></div>

<p>This query shows the correct syntax to query a SalesForce model with to produce a relationship query from parent to child. It resolves to the following query to SalesForce.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT Account.Name, (SELECT Contact.Name FROM
Account.Contacts) FROM Account
</pre>
</div></div>

<p>See the description of the <a href="http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_calls_soql_relationships.htm" class="external-link" rel="nofollow">Relationship Queries</a> operation in the SalesForce documentation for limitations.</p>

<h3><a name="SalesforceTranslator-BulkInsertQueries"></a>Bulk Insert Queries</h3>

<p>SalesForce translator also supports bulk insert statements using JDBC batch semantics or SELECT INTO semantics. The batch size is determined by the execution property <em>MaxBulkInsertBatchSize</em>, which can be overridden in the vdb.xml file. The default value of the batch is 2048. The bulk insert feature uses the async REST based API exposed by Salesforce for execution for better performance.</p>
<h3><a name="SalesforceTranslator-SupportedCapabilities"></a>Supported Capabilities</h3>

<p>The following are the the connector capabilities supported by the Salesforce Connector. These SQL constructs will be pushed down to Salesforce.</p>
<ul>
        <li>SELECT command</li>
        <li>INSERT Command</li>
        <li>UPDATE Command</li>
        <li>DELETE Command</li>
        <li>CompareCriteriaEquals</li>
        <li>InCriteria</li>
        <li>LikeCriteria - Supported for String fields only.</li>
        <li>RowLimit</li>
        <li>AggregatesCountStar</li>
        <li>NotCriteria</li>
        <li>OrCriteria</li>
        <li>CompareCriteriaOrdered</li>
        <li>OuterJoins with join criteria KEY</li>
</ul>


<h3><a name="SalesforceTranslator-NativeQueries"></a>Native Queries</h3>

<p>Salesforce procedures may optionally have native queries associated with them - see <a href="/author/display/TEIID/Translators#Translators-native">Parameterizable Native Queries</a>. The operation prefix (select;, insert;, update;, delete; - see below for more) must be present in the native-query, but it will not be issued as part of the query to the source.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Example DDL for a SF native procedure</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN PROCEDURE proc (arg1 integer, arg2 string) OPTIONS ("teiid_rel:native-query" 'search;SELECT ... complex SOQL ... WHERE col1 = $1 and col2 = $2') returns (col1 string, col2 string, col3 timestamp);
</pre>
</div></div>

<h4><a name="SalesforceTranslator-DirectQueryProcedure"></a>Direct Query Procedure</h4>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">override the execution property</a> called <em>SupportsDirectQueryProcedure</em> to true.</td></tr></table></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>By default the name of the procedure that executes the queries directly is <b>native</b>.  <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">Override the execution property</a> <em>DirectQueryProcedureName</em> to change it to another name.</td></tr></table></div>

<p>The Salesforce translator provides a procedure to execute any ad-hoc SOQL query directly against the source without Teiid parsing or resolving. Since the metadata of this procedure's results are not known to Teiid, they are returned as an object array. <a href="/author/display/TEIID/ARRAYTABLE" title="ARRAYTABLE">ARRAYTABLE</a> can be used construct tabular output for consumption by client applications.  Teiid exposes this procedure with a simple query structure as follows:</p>

<h5><a name="SalesforceTranslator-Select"></a>Select</h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Select Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call sf_source.native('search;SELECT Account.Id, Account.Type, Account.Name FROM Account')) w,
 ARRAYTABLE(w.tuple COLUMNS "id" string , "type" string, "name" String) AS x
</pre>
</div></div>

<p>from the above code, the "search" keyword followed by a query statement.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The SOQL is treated as a parameterized native query so that parameter values may be inserted in the query string properly - see <a href="/author/display/TEIID/Translators#Translators-native">Parameterizable Native Queries</a></td></tr></table></div>

<p>The results returned by search may contain the object Id as the first column value regardless of whether it was selected.  Also queries that select columns from multiple object types will not be correct.</p>

<h5><a name="SalesforceTranslator-Delete"></a>Delete</h5>
<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Delete Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call sf_source.native('delete;', 'id1', 'id2')) w,
 ARRAYTABLE(w.tuple COLUMNS "updatecount" integer) AS x
</pre>
</div></div>
<p>form the above code, the "delete;" keyword followed by the ids to delete as varargs.</p>

<h5><a name="SalesforceTranslator-CreateorUpdate"></a>Create or Update</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Create Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM
 (call sf_source.native('create;type=table;attributes=one,two,three', 'one', 2, 3.0)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>

<p>form the above code, the "create" or "update" keyword must be followed by the following properties.  Attributes must be matched positionally by the procedure variables - thus in the example attribute two will be set to 2.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Property Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Required </th>
</tr>
<tr>
<td class='confluenceTd'> type </td>
<td class='confluenceTd'> Table Name </td>
<td class='confluenceTd'> Yes </td>
</tr>
<tr>
<td class='confluenceTd'> attributes </td>
<td class='confluenceTd'> comma separated list of names of the columns </td>
<td class='confluenceTd'> no </td>
</tr>
</tbody></table>
</div>

<p>The values for each attribute is specified as separate argument to the "native" procedure.</p>

<p>Update is similar to create, with one more extra property called "id", which defines identifier for the record.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Update Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM
 (call sf_source.native('update;id=pk;type=table;attributes=one,two,three', 'one', 2, 3.0)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>By default the name of the procedure that executes the queries directly is called native, however user can<br/>
set override execution property vdb.xml file to change it.</td></tr></table></div>

<h3><a name="SalesforceTranslator-JCAResourceAdapter"></a>JCA Resource Adapter</h3>

<p>The resource adapter for this translator provided through "Salesforce Data Source", Refer to Admin Guide for configuration.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477040&revisedVersion=18&originalVersion=17">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/Salesforce+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>