SQL statement example 1

This is an example of scanning data in the Database Inbound protocol.

In this example, the Database Inbound protocol thread selects all columns from the Table_sanity table. Then, it updates the flag column. Updating the flag column is used to prevent reading duplicate data in the next scan.

Read Action: select * from Table_sanity where Table_sanity.flag=0 order by Table_sanity.ID
Read Success Action:  update Table_sanity set flag=1 where ID=Table_sanity.ID and flag=0

Running this example in Testing Tool results in:

Command Issued: hcidbprotocoltest -r read
Command output:
Executed SQL:
select * from Table_sanity where Table_sanity.flag=0 order by Table_sanity.ID
Read 1 message(s) from DB.
key01,test1,1,10/01/12,0
Doing IB Read Success Action...
Executed SQL:
update Table_sanity set flag=1 where ID=key01 and flag=0
inbound db thread