Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
SELECT * FROM PEOPLE
SELECT FIRSTNAME, LASTNAME FROM PEOPLE WHERE LASTNAME = 'Dawes' ORDER BY LASTNAME
SELECT FIRSTNAME, LASTNAME FROM PEOPLE WHERE LASTNAME LIKE '%Daw%'
DELETE FROM PEOPLE WHERE LASTNAME = 'Dawes'
INSERT INTO PEOPLE (FIRSTNAME, LASTNAME) VALUES ('Chris', 'Dawes')
UPDATE PEOPLE SET FIRSTNAME='Christopher' WHERE FIRSTNAME = 'Chris' AND LASTNAME = 'Dawes'
SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY lastname) AS rn, People.* FROM People) AS tbl WHERE rn BETWEEN 1 AND 25 ORDER BY lastname
SELECT * FROM PEOPLE WHERE FIRSTNAME IN ('Chris','Marty','Ken');


 Hopefully from this list you can start to see how this extension can be used.  If you need to perform more complex queries it is possible but it would require the transport to be modified.

...

Anchor
Revision History
Revision History
Revision History

v1.7 - Sept 2018

  • Now supports queries using WHERE IN

v1.6 - May 11 2017

  • Queries are now case insensitive

...

Type

Parameter

Description

Input

dbName

The name of the WAS dataSource registered in Resources...JDB...Data Sources.  i.e. jdbc/SampleDB

*Deprecated* If dbType = ODBC then this should be the name of the configured DSN.

Input

dbTable

The name of the table.

Input

action

The type of SQL query to be executed. Valid values are insert, select, update, delete.

*Disclaimer* - Be careful with delete and update operations.  If you do not properly supply a valid where clause then you could update or delete ALL the rows of the table you are accessing.

Input

dbType

Valid Value is DataSource. 

*Deprecated* the previous values, since the individual database drivers are no longer included in the jar file: Oracle, DB2, MySQL, ODBC, MsSQL

Input

dbServer

The host name of the database server.

Input

dbPort

The port of the database server. (i.e. 50000)

Input

dbUser

The User name of the user to connect to the database.

*Deprecated* - Use WAS-J2CAlias instead

Input

dbPassword

The password of the user to connect to the database.

*Deprecated* - Use WAS-J2CAlias instead

Input

WAS-J2CAlias

The alias for the user that should be used to connect to the database. Note: You can configure this in the WAS Admin Console:

- Security...Global Security

- Java Authentication...J2C Authentication Data...

- New...Enter the Alias, username and password

Input

assign_<columnName>

Defines the columns that will be used in the assignment clause of applicable SQL queries. For example, creating the following parameters assign_nameassign_age would result in :

Select name, age from person

If you don't supply any then * will be used for the query:

Select * from person

Input

where_<columnName>

Defines the columns that will be used in the where clause of applicable SQL queries. For example, creating the following parameters where_name would result in:

Select * where name = <value>

Note: Any parameter that has a value will automatically be added to the transport outbound parameter list.  So if you want to return the values of the where parameters as single items outside of the result set then add individual outbound parameters to your outbound mapping. (Added in v 1.3)

InputwhereOp_<columnName>Valid value is LIKE, case insensitivevalues are LIKE (Added in v1.5), STARTSWITH, and IN (Added in v1.7).  Only specify this for the column name if you want to use wild card (LIKE '%x%') instead of an equality (=) search. (Added in v1.5)
Input

whereOperator

This determines the relationship between multiple where clauses. There can only be one relationship. Valid values are AND and OR

InputorderByThe column name to use to sort the results (SELECT only).  Required if paginating the results. (Added in v1.5)
InputorderByOpValid values are ASC or DESC. Optional, defaults to ASC. (Added in v1.5)
InputpageNum

Paginates the query results.  Page number.  Pagination may not work with all databases (I have only tested it against DB2), it is using the SQL query like:

Code Block
languagesql
SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY lastname) AS rn, People.* FROM People) WHERE rn BETWEEN 1 AND 2 ORDER BY lastname.

(Added in v1.5)

InputitemsPerPagePaginates the query results. Specify Items per page. (Added in v1.5)
InputincludeBlankValuesValid values are true or false, default is false.  All of the "assign_" parameters will be used to build the query even if they are blank. This parameter is critical to a select action where you defined all the "assign_" parameters that you want returned in the query but none of them are actually being used as inputs to the service (where the fields contain values).
InputincludeWhereInOutValid values are true or false, default is false. If true, the parameters that are defined as "where" parameters will automatically be included in the service results.
Output<columnName>Each column of the result set will be provided (in uppercase) as an output parameter.
OutputsuccessReturns true if the query is processed without error, otherwise false.
OutputrowsAffectedThe number of rows affected by the INSERT, DELETE or UPDATE query. For SELECT will contain the number of rows returned.
OutputqueryResults

The results of the SELECT query. This is a list object where each row contains the columns that were defined by the assignment portion of the query.  The returned parameters are in upper case, so your mapping might look something like:

Code Block
languagexml
<mapping source="transport:queryResults" target="parameter:queryResults">
      <mapping source="transport:FIRSTNAME" target="parameter:firstname" />
      <mapping source="transport:LASTNAME" target="parameter:lastname" />
      <mapping source="transport:EMAIL" target="parameter:email" />
</mapping>


OutputstateThe SQL state, only returned if the SQL query fails.
OutputmessageThe SQL message, only returned if the SQL query fails.
OutputerrorThe SQL error code, only returned if the SQL query fails.

...