7 database commands, Database commands – Rice Lake 720i Programmable Indicator/Controller - Installation Manual User Manual
Page 101

Serial Commands
95
10.1.7
Database Commands
The commands listed in Table 10-12 can be used to
create and maintain databases in the
720i
. Except for
t h e
D B . D E L A L L
c o m m a n d , a l l o f t h e d a t a b a s e
commands require an extension to identify the number
of the database within the memory card and the slot
number of the memory card.
Table 10-12. Database Commands
Command
Description
DB.ALIAS.n#x
Get or set database name
DB.CLEAR.n#x
Clear database contents
DB.DATA.n#x
Get or set database contents
DB.SCHEMA.n#x
Get or set database structure
DB.DELALL
Delete all databases and database
contents
n represents the database number within the memory card; x
is the slot number of the memory card.
Each command must be terminated with a carriage return
character (
DB.ALIAS
The
DB.ALIAS
command is used to get or set the alias
used by
PCEE
programs to reference the specified
database. Each database alias must be unique among all
databases and adhere to the following rules: 8 character
maximum; must begin with an alpha character or an
underscore; can only contain A–Z, a–z, 0–9, or an
underscore (_).
Example.
The following command assigns an alias of
TRUCKS_2 to the first database on the memory card
installed in slot 2:
DB.ALIAS.1#2=TRUCKS_2
Sending the
DB. A LIA S
command alone, without
assigned data, returns the current database alias.
DB.CLEAR
To clear the contents of a database, send the following
command:
DB.CLEAR.n#x
Where:
n
is the database number within the memory card
x
is the slot number of the memory card (0 is the
onboard memory)
The
720i
responds with
OK
if the command is
successful,
??
if unsuccessful.
DB.DATA
The
DB.DATA
command can be used to send data to or
retrieve data from the
720i
.
Data can be sent to the indicator using the following
command:
DB.DATA.n#x = data{ | }
Where:
n
is the database number within the memory card
x
is the slot number of the memory card (0 is the
onboard memory)
data
represents a single cell of a row of data
{ | }
is a pipe character (ASCII 124), used to delimit
cell data. If the data being sent is not the last cell of
the row, append the pipe character to the data to
indicate that more data is coming for that particular
row. If the data being sent is the last cell of the row,
do not append the pipe character.
If the command is accepted, the
720i
responds with
OK
; if not, it responds with
??
Example.
The following commands place the data shown
in Table 10-13 into the first database in the onboard
memory:
DB.DATA.1#0=this|
DB.DATA.1#0=is|
DB.DATA.1#0=a|
DB.DATA.1#0=test
DB.DATA.1#0=aaa|
DB.DATA.1#0=bbb|
DB.DATA.1#0=ccc|
DB.DATA.1#0=ddd
Table 10-13. Sample Database Contents
Record
Cell
1
2
3
4
first
this
is
a
test
second
aaa
bbb
ccc
ddd
Sending the
D B . D A TA
command alone, without
assigned data, returns the database contents:
DB.DATA.n#x
The
720i
responds with the entire contents of the
database. Returned data is cell-delimited with the pipe
character (ASCII 124) and row-delimited with carriage
returns (ASCII 13).
For example, the following command could be used to
return the contents of database 1 in the onboard
memory:
DB.DATA.1#0
If the database contents are the records shown in
Table 10-13, the indicator responds with the following
data, using pipe characters and carriage returns to
delimit the database cells and rows, respectively:
t h i s | i s | a | t e s t < C R > a a a | b b b | c c c | d d d < C R >
Note
There is no end of database notification at the
end of the DB.DATA
command
transmission.
Use a receive time-out to determine command
completion. The time-out value will vary based
on baud rate.