UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Parameter Description Examples In the following example, the program segment executes a UniData SQL command: 1-272 UniBasic Commands Reference ASYNC | SYNC UniData no longer supports this parameter, but it remains for syntax compatibility. ON connection UniData no longer supports this parameter, but it remains for syntax compatibility. ON ERROR statements UniData no longer supports this parameter, but it remains for syntax compatibility. EXECUTESQL Parameters (continued) OUT.COMMAND = "SELECT NAME, ADDRESS, CITY" OUT.COMMAND := " FROM CLIENTS;" EXECUTESQL OUT.COMMAND CLEARSELECT The following output displays on the terminal screen when you execute the preceding program: Page 1 Name Address City ------------------------------ ------------------------- --------- ------ Paul Castiglione 45, reu de Rivoli Paris Fredrick Anderson 854, reu de Rivoli Paris Beverly Ostrovich 7925 S. Blake St. Sydney Cal di Grigorio 913 Montreal Ave. Regina Franklin Sears 213 Midland St. Perth Gino Lee 483 E. Silverman St. Fonthill JoAnn Casey 4024 South Ivywood Circle Omaha ...
In the next example, the program segment executes the same UniData SQL command with a TO clause that stores the UniData SQL output in a file that you can access using the READNEXTTUPLE statement. (This program uses the CLIENTS file in the demo database.) OUT.COMMAND = "SELECT NAME, ADDRESS, CITY, STATE" OUT.COMMAND := " FROM CLIENTS TO SQL_INPUT;" EXECUTESQL OUT.COMMAND DONE = 0 FOR X = 1 TO 5 READNEXTTUPLE CLIENT.INFO FROM "SQL_INPUT" ELSE STOP CONVERT @AM TO " " IN CLIENT.INFO PRINT CLIENT.INFO NEXT X CLEARSELECT END This program produces the following results: Paul Castiglione 45, reu de Rivoli Paris Fredrick Anderson 854, reu de Rivoli Paris Beverly Ostrovich 7925 S. Blake St. Sydney NSW Cal di Grigorio 913 Montreal Ave. Regina Saskatchewan Franklin Sears 213 Midland St. Perth In the next example, the UniData SQL statement selects an @ID only. UniData uses a select list instead of storing the output. In this case, the UniData SQL command does not require a TO clause, and the UniBasic READNEXT statement processes the IDs selected. OPEN 'CLIENTS' TO CLIENT.FILE ELSE PRINT 'Open Error.' OUT.COMMAND = "SELECT @ID" OUT.COMMAND := " FROM CLIENTS" OUT.COMMAND := " WHERE CITY = 'Paris';" EXECUTESQL OUT.COMMAND DONE = 0 LOOP READNEXT @ID ELSE DONE = 1 UNTIL DONE DO GOSUB PROCESS.RECS REPEAT CLEARSELECT PROCESS.RECS: *print records for clients in Paris." READ REC FROM CLIENT.FILE,@ID THEN PRINT REC RETURN END EXECUTESQL 1-273
- Page 228 and 229: EDADRV_Connect Syntax RETCODE EDADR
- Page 230 and 231: EDADRV_Disconnect Syntax RETCODE ED
- Page 232 and 233: 1-226 UniBasic Commands Reference
- Page 234 and 235: Return Codes The following table de
- Page 236 and 237: Output Variable The following table
- Page 238 and 239: Output Variables The following tabl
- Page 240 and 241: EDADRV_GetDBInfo Syntax RETCODE EDA
- Page 242 and 243: EDADRV_GetEDAAttr Syntax RETCODE ED
- Page 244 and 245: EDADRV_GetErrmsg Syntax RETCODE EDA
- Page 246 and 247: Input Variables The following table
- Page 248 and 249: EDADRV_LoadSymbols Syntax RETCODE E
- Page 250 and 251: Output Variables The following tabl
- Page 252 and 253: Return Codes The following table de
- Page 254 and 255: Input Variables The following table
- Page 256 and 257: STATUS Codes ENABLEDEC has the foll
- Page 258 and 259: Parameter Description dataLoc 1 - D
- Page 260 and 261: Parameters he following table descr
- Page 262 and 263: END Syntax END Description The UniB
- Page 264 and 265: Related Commands UniBasic CALL, CHA
- Page 266 and 267: Examples In the following example,
- Page 268 and 269: EQU Syntax EQU constant1 TO value1
- Page 270 and 271: In the next example, UniData replac
- Page 272 and 273: EXECUTE Syntax EXECUTE "str.expr" [
- Page 274 and 275: Parameter Description Reminder: The
- Page 276 and 277: Related Commands UniBasic COMMON, E
- Page 280 and 281: The program output is: 1-274 UniBas
- Page 282 and 283: EXP Syntax EXP(expr) Description Th
- Page 284 and 285: Examples The following program segm
- Page 286 and 287: In the next example, the program se
- Page 288 and 289: Options The value of option determi
- Page 290 and 291: FILEINFO Syntax FILEINFO(file.var,
- Page 292 and 293: Code 9 Merge factor percentage 10 S
- Page 294 and 295: FILELOCK Syntax FILELOCK [file.var]
- Page 296 and 297: FILEUNLOCK Syntax FILEUNLOCK [file.
- Page 298 and 299: FIND Syntax FIND expr IN dyn.array[
- Page 300 and 301: Related Commands UniBasic [], FINDS
- Page 302 and 303: Parameter Description Examples In t
- Page 304 and 305: FMT Syntax FMT(expr, "len [f.char]
- Page 306 and 307: STATUS Function Return Values After
- Page 308 and 309: FOOTING Syntax FOOTING [ON num.expr
- Page 310 and 311: Related Commands UniBasic GETPTR, H
- Page 312 and 313: This program segment produces the f
- Page 314 and 315: Parameter Description Examples The
- Page 316 and 317: FUNCTION Syntax FUNCTION function.n
- Page 318 and 319: The following program calls the pre
- Page 320 and 321: GE Syntax expr1 GE expr2 Synonyms #
- Page 322 and 323: generateKey Syntax generateKey(priv
- Page 324 and 325: Return Code Status 1-286 UniBasic C
- Page 326 and 327: GET Syntax GET[X] var[,length] [SET
In the next example, the program segment executes the same UniData SQL command<br />
with a TO clause that stores the UniData SQL output in a file that you can access<br />
using the READNEXTTUPLE statement. (This program uses the CLIENTS file in<br />
the demo database.)<br />
OUT.COMMAND = "SELECT NAME, ADDRESS, CITY, STATE"<br />
OUT.COMMAND := " FROM CLIENTS TO SQL_INPUT;"<br />
EXECUTESQL OUT.COMMAND<br />
DONE = 0<br />
FOR X = 1 TO 5<br />
READNEXTTUPLE CLIENT.INFO FROM "SQL_INPUT" ELSE STOP<br />
CONVERT @AM TO " " IN CLIENT.INFO<br />
PRINT CLIENT.INFO<br />
NEXT X<br />
CLEARSELECT<br />
END<br />
This program produces the following results:<br />
Paul Castiglione 45, reu de Rivoli Paris<br />
Fredrick Anderson 854, reu de Rivoli Paris<br />
Beverly Ostrovich 7925 S. Blake St. Sydney NSW<br />
Cal di Grigorio 913 Montreal Ave. Regina Saskatchewan<br />
Franklin Sears 213 Midland St. Perth<br />
In the next example, the UniData SQL statement selects an @ID only. UniData uses<br />
a select list instead of storing the output. In this case, the UniData SQL command<br />
does not require a TO clause, and the <strong>UniBasic</strong> READNEXT statement processes the<br />
IDs selected.<br />
OPEN 'CLIENTS' TO CLIENT.FILE ELSE PRINT 'Open Error.'<br />
OUT.COMMAND = "SELECT @ID"<br />
OUT.COMMAND := " FROM CLIENTS"<br />
OUT.COMMAND := " WHERE CITY = 'Paris';"<br />
EXECUTESQL OUT.COMMAND<br />
DONE = 0<br />
LOOP<br />
READNEXT @ID ELSE DONE = 1<br />
UNTIL DONE DO<br />
GOSUB PROCESS.RECS<br />
REPEAT<br />
CLEARSELECT<br />
PROCESS.RECS:<br />
*print records for clients in Paris."<br />
READ REC FROM CLIENT.FILE,@ID<br />
THEN PRINT REC<br />
RETURN<br />
END<br />
EXECUTESQL 1-273