Академический Документы
Профессиональный Документы
Культура Документы
Trademarks
InterAct, Intergraph, and RIS are registered trademarks of Intergraph Corporation. DIALOG, InterServe, and TD1
are trademarks of Intergraph Corporation. All other brands and product names are trademarks of their respective
owners.
Copyright
1996 Intergraph Corporation
All Rights Reserved
Including software, file formats, and audiovisual displays; may be used pursuant to applicable software license
agreement; contains confidential and proprietary information of Intergraph and/or third parties which is protected
by copyright and trade secret law and may not be provided or otherwise made available without proper
authorization.
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of
The Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraphs (c) (1) and
(2) of Commercial Computer Software Restricted Rights at 48 CFR 52.227-19, as applicable.
Unpublished rights reserved under the copyright laws of the United States.
Intergraph Corporation
Huntsville, Alabama 35894-0001
Table of Contents
__________________________________________________________________________________________________________________________________________________
Table of Contents
__________________________________________________________________________________________________________________________________________________
1.
2.
1-3
1.1
1.2
1.3
1.4
1-3
1-3
1-3
1-5
1.4.1
1-5
2-3
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
2-3
2-4
2-4
2-4
2-4
2-5
2-9
2 - 11
2 - 14
2.9.1
2.9.2
2.9.3
2.9.4
2 - 15
2 - 16
2 - 18
2 - 21
2 - 23
2 - 24
3-3
3.1
3.2
RIS_BLOB ....................................................................................................
RIS_TEXT ....................................................................................................
3-3
3-6
4-3
4.1
4.2
4.3
4-3
4-6
4-6
5-3
2.10
2.11
3.
4.
5.
5.1
5.2
5.3
6.
5-3
5-7
5-7
6-3
6.1
6.2
6.3
6.4
6.5
6.6
6.7
7.
6-3
6-4
6-9
6 - 10
6 - 11
6 - 12
6 - 13
7-3
7.1
7.2
7.3
7.4
7-3
7-4
7-4
7-5
7.4.1
7.4.2
7-8
7-8
7 - 17
7.5.1
7 - 19
7 - 27
7.6.1
7.6.2
7 - 27
7 - 29
7 - 31
7.5
7.6
7.7
Appendix A:
A.1
A.2
A.3
A.4
A.5
A.6
A.7
A.8
A.9
A.10
A.11
A.12
A.13
A-3
A-3
A-3
A-3
A-4
A-5
A-6
A-6
A-7
A-8
A - 11
A - 12
A - 12
A - 12
A.14
Internationalization .........................................................................................
Appendix B:
B.1
B.2
B.3
B.4
B.5
B.6
B.7
B.8
B.9
B.10
B.11
B.12
B.13
B.14
B.15
B.16
A - 13
B-3
B-3
B-3
B-4
B-4
B-5
B-5
B-5
B-6
B-6
B-6
B-7
B-7
B-7
B - 10
B - 12
B - 12
Appendix C:
C-3
Appendix D:
D-3
D-3
D-3
D-5
Glossary .......................................................................................................................
GL - 3
Index ............................................................................................................................
IN - 3
D.1
D.2
D.3
__________________________________________________________________________________________________________________________________________________
1-2
1.
__________________________________________________________________________________________________________________________________________________
1-4
The word select means to select a command by pressing the left mouse button over a
menu command or by pressing the Alt key and the underlined character
simultaneously.
The word choose means to choose a button or icon by pressing the left mouse button
over a Toolbar button, or application icon.
The word reset means to terminate a command initiated with the mouse. Reset by
pressing the right mouse button.
The word identify means to define an area or place graphic elements in a graphics file.
For PCs, identify with the left mouse button.
The phrase key in generally means to enter data into a field on a dialog box. To
advance to the next field, use the Tab key.
System key-ins, keywords, and programming code segments, appear in monospaced
type. For example:
main ( )
OR
commit In actual usage, keywords can be in either upper or lowercase.
Words that appear in angle brackets, < >, are identifiers or names that you must
supply, or dynamic information that can change for each error message. For example:
ERROR: Error opening the file <filename>
Phrases in square brackets, [ ], are optional phrases.
Curly braces contain several options (used in conjunction with a logical OR symbol ( | )
or phrases that can be repeated (used in conjunction with [, ...]). A comma followed by a
series of three periods in square brackets ([, ...]) indicates that the last phrase contained
within curly braces ({}), or the last item, can be repeated numerous times (separated by
commas).
For example: { <column> <data type> } [, ...] means that numerous column names and
associated data types can be specified (separated by commas).
The logical or symbol ( | ) separates phrases or keywords within curly braces ({}) that
can be used alone but not together.
For example: { user | database } means that either the user keyword or the
database keyword can be specified, but not both.
This symbol notes important information.
This symbol cautions about operations that can cause limited damage.
This symbol warns about operations that can cause severe damage.
1-6
Use
To
Contents
Search
Back
History
Find
<<
>>
1-8
__________________________________________________________________________________________________________________________________________________
2-2
2.
__________________________________________________________________________________________________________________________________________________
2-4
The RIS interface is based on the American National Standards Institute (ANSI) Structured
Query Language (SQL) standard and is therefore compatible with all RDBMSs that are
compatible with the standard.
The riscpp.exe preprocessor automatically tries to link with the User Message System (UMS)
library. If the UMS library does not exist, riscpp.exe returns an error. The riscpp.exe
preprocessor also calls the Microsoft Visual C++ compiler to compile and link the program,
unless directed otherwise, and creates an executable.
Files processed by riscpp.exe must end in the suffix .rc (for example, filename.rc). The
preprocessor can be invoked as follows:
riscpp.exe [<flags>] [@command file] <filename>
Flag
_____
Description
___________
-r
-l
-I <dir>
-V
-ext
-DWIN32
The riscpp.exe preprocessor returns zero (0) to the shell if the program was processed
successfully and one (1) if unsuccessful. When the -r option is used, the .c file must be
compiled and linked manually.
2-6
Linking Files
The following lists show the order and names of the link files and the products with which
they are associated:
File
_Library/Object
_________________
Description
___________
Users libraries/objects
<RISDP>\ris.lib
<RISDP>\risforms.lib
<RISDP>\rislduld.lib
<MSVC>\msvcrt.lib
<MSVC>\kernel32.lib
Win32api library.
<MSVC>\advapi32.lib
<MSVC>\user32.lib
<SHARE>\i9shamr2.dll
<SHARE>\i9ums2.dll
The previous table is based on whether the RIS Development Platform product
for 32-bit applications is installed in the directory <RISDP> (the default
directory is c:\Program Files\risdp) and the shared component is installed in
the directory <SHARE> (the default directory is c:\Program Files\Common
Files\Intergraph). The <MSVC> directory is the location of the Microsoft
Visual C++ Tools software (the default directory is c:\msvc20\lib).
The following figure shows the steps taken when processing a 32-bit RIS file.
Examples
Creating an executable .exe file directly from the .rc file:
riscpp.exe -DWIN32 main_app.rc
OR
riscpp.exe -DWIN32 main.rc func1.rc func2.rc -I c:\myapp\include
riscpp.exe preprocesses three files: main.rc, func1.rc, func2.rc. It then produces the
files: main.c, func1.c, and func2.c. The preprocessor invokes the compiler and
automatically compiles the .c files to produce the .obj files. It then invokes the linker to
link the .obj files with the libraries and creates an executable. The -I option directs the
compiler to the directory c:\myapp\include.
Preprocessing the .rc file using riscpp.exe with the -r option:
riscpp.exe -r main_app.rc
After the .c file is generated, compile the .c file and link it with the required libraries
using the Microsoft Visual C++ compiler as follows:
cl -DWIN32 main_app.c
c:\Program Files\risdp\lib\ris.lib
kernel32.lib advapi32.lib user32.lib
2-8
Files
_____
<RISDP>\bin\riscpp.exe
<RISDP>\lib\ris.lib
<RISDP>\include\ris.h
<RISDP>\include\ris_err.h
<RISDP>\include\net_err.h
<RISDP>\include\rislimit.h
<RISDP>\include\ris.prt
<SHARE>\ris<major.minor>\config\english\messages\ris.msg
The major and minor version numbers are determined as follows:
In the product release number 05.01, the major number is 05 and the minor number is 01.
Status
Returns
______________
0
1
Normal termination.
Abnormal termination.
2 - 10
Type
_____
Name
______
Description
___________
char [8]
sqlcaid
long
sqlabc
long
sqlcode
char [512]
sqlerrmc
short
sqlerrml
short
pad
Not used.
char [8]
sqlerrp
Not used.
long [8]
sqlerrd
char [8]
sqlwarn
char [8]
sqlext
Not used.
char *
sqlstmt
RIS also provides the pointer dbca that points to a rissqlca structure containing the
error number and message from the underlying DBMS. This structure provides
database-specific error information and can only be accessed through the dbca pointer.
Only the sqlcode and sqlerrm fields are currently supported.
Using the dbca pointer renders your application nonportable because
information contained in the rissqlca structure is specific to a particular
database system and different database systems support different
structure fields. Use the dbca pointer only for informational purposes.
2 byte: short
4 byte: int
Floating Point
Character
Pointer: char *
String: char[] (NULL terminated by RIS)
Examples
_________
exec sql begin declare section;
char building_name[15];
char drawing_rev[15];
long drawing_rev_ind;
char *error_ptr;
exec sql end declare section;
2 - 12
Examples
_________
exec sql insert into location (building_name, room_no, location_no)
values (:building_name, :room_no, :location_no);
Host variables cannot be directly referenced from a dynamic SQL string (an SQL statement
not known at compile time). To parameterize a dynamic SQL statement, use a question
mark (?) for the unknown value. The question mark replaces the host variable in the SQL
statement. Later, when the statement is opened or executed, host variables can be bound to
the question mark with the using clause. Dynamic SQL statements are discussed further in
the sections Dynamic Noncursor SQL Statements and Dynamic Cursor SQL Statements.
Indicator Variables
Indicator variables can be used to manage NULL data. These variables are constructed by
following a host variable with the indicator variable (for example, :variable1:indicator1).
Indicator variables are long integers that can optionally be used, with input or output
variables, to indicate if a NULL value is being inserted or retrieved. These variables can also
be checked to see whether data input or output is NULL and are useful in trapping
input/output errors. For example, a host variable used with an indicator variable for data
input would trap NULL data and prevent an attempt to input a NULL value into a column
declared with the not null keywords.
NULL values are indicated as follows:
Value < 0 indicates a NULL
Value >= 0 indicates not NULL
Examples
_________
exec sql select emp_no, emp_name
into :employee_no, :employee_name:emp_name_ind
from employee where emp_no = :emp_in_no;
exec sql insert into location (building_name, room_no,
location_no, drawing_no, drawing_rev)
values (:building_name, :room_no, :location_no
:drawing_no:drawing_no_ind,
:drawing_rev:drawing_rev_ind);
Virtual Variables
Because the SQL Standard uses simple scalar types for host variables, RIS provides a special
variable declaration format to allow complex typing and addressing expressions for host
variables. This format is called a virtual variable declaration. Virtual variable declarations
do not result in any additional C code.
Keyword/Identifier
__________________
Description
___________
<virtual variable>
<C type>
<address
expression>
Examples
_________
The following statements compare the contents of pointer1->array2[5] to column1 when
the SQL statement is executed.
exec sql begin declare section;
virtual int dummy_var as pointer1->array2[5];
exec sql end declare section;
select * from table1 where column1 = :dummy_var;
Incorrect syntax or addressing in the <address expression> clause does not cause the
preprocessor to generate errors, but may cause errors during compilation or at runtime.
In the following section of code, an integer i is declared. In the virtual declaration, the
address expression references i as a pointer to an integer. RIS does not catch this error,
but the C compiler does. The error message is most likely an illegal operation.
exec sql begin declare section;
int i;
virtual int my_int as *i;
exec sql end declare section;
See
Also
________
prepare
2 - 14
1.
2.
3.
Cursor statements all select statements (except the special select into statement).
4.
Noncursor statements all other SQL statements (including the special select into
statement).
The following example assigns values to the host variables var1 and var2 and inserts them
into table1.
var1 = 1;
var2 = 2;
exec sql insert into table1 (col1, col2) values (:var1, :var2);
The following example inserts NULL values into col1 and col2 of table1 by using indicator
variables set to a negative number.
ind1 = -1;
ind2 = -1;
exec sql insert into table1 (col1, col2)
values (:var1:ind1, :var2:ind2);
2 - 16
Declare a cursor work area for use by the static statement and check the syntax of the
statement.
exec sql declare <cursor> cursor for <select-statement>;
2.
Open the cursor to execute the statement and set up a cursor for fetching.
exec sql open <cursor>;
3.
Fetch the information to retrieve one row of results from the cursor. To retrieve
another row of results, issue the fetch statement again. When there are no more result
rows, SQLCODE is set to END_OF_DATA.
loop
exec sql fetch <cursor> into <host variables>;
until END_OF_DATA;
4.
Close the cursor. When a cursor is closed and then reopened, it will be pointing at the
beginning of the data.
exec sql close <cursor>;
5.
Clear the cursor to free all memory used by the static statement and render the cursor
useless. The cursor cannot be reopened once cleared.
exec sql clear cursor <cursor>;
Examples
_________
The following example declares the cursor curs1. When opened, curs1 selects col1 and
col2 from table1. The two columns are then fetched into the host variables result1 and
result2.
exec sql declare curs1 cursor for select col1, col2 from table1;
exec sql open curs1;
do
{
exec sql fetch curs1 into :result1, :result2;
}
while ( SQLCODE != END_OF_DATA );
exec sql close curs1;
exec sql clear cursor curs1;
The following example declares the cursor curs1. When opened, curs1 selects col1 and
col2 from table1. The two columns are then fetched into the host variables result1 and
result2. The indicator variable is set to a negative value if the column retrieved had a
NULL value in it.
exec sql declare curs1 cursor for select col1, col2 from table1;
exec sql open curs1;
do
{
exec sql fetch curs1 into :result1:ind1, :result2 :ind2;
}
while ( SQLCODE != END_OF_DATA );
exec sql close curs1;
exec sql clear cursor curs1;
2 - 18
2.
3.
2.
3.
4.
Examples
_________
The following examples demonstrate the two ways to dynamically execute an insert
statement. The first way assigns the statement to the character pointer char_ptr,
prepares into statement ID stmt1, executes, and clears. The second way uses the
execute immediate statement for the same task.
strcpy(char_ptr, "insert into t1 values (1,2)");
exec sql prepare stmt1 from :char_ptr;
exec sql execute stmt1;
exec sql clear stmt1;
OR
The following example executes a parameterized insert statement. The values inserted
into the table are specified (in the statement string) using question marks (?). The
using clause in the execute statement substitutes the appropriate host variables var1
and var2 for the two question marks.
strcpy(char_ptr, "insert into t1 values (?,?)");
exec sql prepare stmt1 from :char_ptr;
var1 = 1;
var2 = 2;
exec sql execute stmt1 using :var1, :var2;
exec sql clear stmt1;
2 - 20
The following example executes a noncursor statement that is not known at compilation
time. This statement may or may not have parameters. If it has parameters, allocate a
single sqlda structure and one sqlvar structure for each parameter. These structures
must then be filled with information about the input data buffers being bound to the
parameters. See the statement description and the using clause description for more
information about the sqlda and sqlvar structures.
exec sql prepare stmt2 from :sql_string1;
desc1 = (sqlda *)malloc(sizeof(sqlda));
desc1->sqln = 0;
exec sql describe input stmt2 using descriptor desc1;
desc1->sqln = desc1->sqld;
desc1->sqlvar = (sqlvar *)malloc(sizeof(sqlvar)*desc1->sqln);
exec sql describe input stmt2 using descriptor desc1;
for (i=0;i < desc1->sqld;i++)
{
desc1->sqlvar[i].sqldata = malloc(desc1->sqlvar[i].sqllen);
desc1->sqlvar[i].sqlind = (long *)malloc(sizeof(long));
*desc1->sqlvar[i].sqldata = i;
*desc1->sqlvar[i].sqlind = 0;
}
exec sql execute stmt2 using descriptor desc1;
exec sql clear stmt2;
2.
3.
4.
5.
6.
7.
8.
The describe, declare, and open statements can be ordered as needed. However, since the
open statement uses input information, all input information must be filled in before this
statement is executed.
Use the describe statement to determine how many sqlda and sqlvar structures are needed
for input or output variables. You must allocate one sqlda for input and one sqlda for output.
Additionally, an sqlvar for each input and output variable must be allocated. For more
information on using the describe statement, see the describe statement description.
2 - 22
Examples
_________
The following example is similar to the previous example for a dynamic noncursor statement.
It differs in that you must allocate and fill in another sqlda structure and a set of sqlvar
structures to define the output buffers for the fetched data. See the describe statement
description and the using clause description for more information.
prepare stmt3 from :sel_string3;
in_desc = (sqlda *)malloc(sizeof(sqlda));
in_desc->sqln = 0;
exec sql describe input stmt3 using descriptor in_desc;
in_desc->sqln = in_desc->sqld;
in_desc->sqlvar = (sqlvar *)malloc(sizeof(sqlvar)*in_desc->sqln);
exec sql describe input stmt3 using descriptor in_desc;
for (i=0;i < in_desc->sqld;i++)
{
in_desc->sqlvar[i].sqldata = malloc(in_desc->sqlvar[i].sqllen);
in_desc->sqlvar[i].sqlind = (long *)malloc(sizeof(long));
*in_desc->sqlvar[i].sqldata = i;
*in_desc->sqlvar[i].sqlind = 0;
}
out_desc = (sqlda *)malloc(sizeof(sqlda));
out_desc->sqln = 0;
exec sql describe output stmt3 using descriptor out_desc;
out_desc->sqln = out_desc->sqld;
out_desc->sqlvar = (sqlvar *)malloc(sizeof(sqlvar)*out_desc->sqln);
exec sql describe output stmt3 using descriptor out_desc;
for (i=0;i < out_desc->sqld;i++)
{
out_desc->sqlvar[i].sqldata = malloc(out_desc->sqlvar[i].sqllen);
out_desc->sqlvar[i].sqlind = (long *)malloc(sizeof(long));
}
exec sql declare curs3 cursor for stmt3;
exec sql open curs3 using descriptor in_desc;
do
{
exec sql fetch curs3 using descriptor out_desc;
}
while (SQLCODE != END_OF_DATA);
exec sql close curs3;
exec sql clear cursor curs3;
2 - 24
Add the async keyword and a host variable for the asynchronous statement identifier to
the embedded SQL statement.
exec sql insert into tools (hammer, 2000, 9.95);
becomes
exec sql async :async_id insert into tools (hammer, 2000, 9.95);
2.
Determine when the statement completes execution by using a test or wait completion
statement.
exec sql test :async_id completion;
OR
exec sql wait :async_id completion;
3.
For more information about multiple transactions, see the section Multiple Transactions.
Examples
_________
The following example executes an insert statement asynchronously.
main()
{
exec sql
int
exec sql
exec sql
/*
** The following asynchronous insert statement returns control
** immediately to the application, while executing the insert
** statement as a background process. So that, application can
** go ahead and execute another asynchronous statement on
** another schema.
*/
exec sql async :asyncl insert into table1 values (ris_async_test);
/*
** Check to see if the statement is completed
*/
exec sql test :asyncl completion;
/* If the statement has not completed, then wait for its
** completion before proceeding further (if necessary)
*/
2 - 26
__________________________________________________________________________________________________________________________________________________
3-2
3.
__________________________________________________________________________________________________________________________________________________
3.1 RIS_BLOB
The RIS_BLOB data type can be used in embedded insert, update, and fetch statements to
manipulate data in a file or character pointer array. It cannot be used in indexing or in
where, order, or group clauses.
The fields of the RIS_BLOB structure are described in the following table. See the ris.h file
for the actual structure declaration.
Data
Type
__________
Name
______
Description
___________
char
*filename
char
*array
unsigned int
array_size
unsigned int
input_len
unsigned int
output_len
3-4
unsigned int
file_offset
unsigned char
file_used
1 = a file is to be used.
0 = a character array is to be used.
char
pad[11]
Not used.
The fields in this structure must be set before accessing blob data as input or
output parameters through the sqlvar structure.
Because RIS does not track the data object length, your application must track this length.
Therefore, the array_size field must be sufficiently allocated to hold the entire blob. RIS
makes no attempt to ensure this array is properly allocated.
During an insert, RIS returns an error if the file size is larger than the blob column size.
However, INFORMIX and ORACLE allow the insertion of blob data larger than the specified
blob column size.
During a retrieval, the data is truncated if the array size is smaller than the column size. No
truncation occurs when using a file.
The file_offset field offers a convenient way to fetch multi-blob columns into one file. RIS
appends the blob data to the file by the size specified in the file_offset field. The data is
appended to the end of the file if the file_offset field specifies a length exceeding the current
file size. If the file does not exist, RIS creates the output file and ignores the file_offset field.
To overwrite an existing file, set file_offset to zero.
Examples
_________
#include
#include
#include
#include
<stdio.h>
<fcntl.h>
<errno.h>
"ris.prt"
3-6
The describe SQL statement does not return the actual length of the blob
column in the sqllen field of the sqlvar structure. RIS sets sqllen to the size of
the ris_blob structure. You must query the ris5columns dictionary table to get
the actual length of the blob column.
3.2 RIS_TEXT
The RIS_TEXT data type can be used in embedded insert, update, and fetch statements to
manipulate data in a file or character pointer array. It cannot be used in indexing or in
where, order, or group clauses.
The fields of the RIS_TEXT structure are described in the following table. See the ris.h file
for the actual structure declaration.
Data
Type
__________
Name
______
Description
___________
char
*filename
char
*array
unsigned int
array_size
unsigned int
input_len
unsigned int
output_len
unsigned int
file_offset
unsigned char
file_used
1 = a file is to be used.
0 = a character array is to be used.
char
pad[11]
Not used.
The fields in this structure must be set before accessing text data as input or
accessing output parameters through the sqlvar structure.
Because RIS does not track the data object length, your application must track this length.
Therefore, the array_size field must be sufficiently allocated to hold the entire text file. RIS
makes no attempt to ensure this array is properly allocated.
During an insert, RIS returns an error if the file size is larger than the text column size.
However, INFORMIX and ORACLE allow the insertion of text data larger than the specified
text column size.
During a retrieval, the data is truncated if the array size is smaller than the column size. No
truncation occurs when using a file.
The file_offset field offers a convenient way to fetch multi-text columns into one file. RIS
appends the text data to the file by the size specified in the file_offset field. The data is
appended to the end of the file if the file_offset field specifies a length exceeding the current
file size. If the file does not exist, RIS creates the output file and ignores the file_offset field.
To overwrite an existing file, set file_offset to zero.
Examples
_________
#include
#include
#include
#include
<stdio.h>
<fcntl.h>
<errno.h>
"ris.prt"
3-8
/*
** Select the column size of from ris5column table
*/
exec sql select char_max_length into :column_len from
ris5columns where table_name = document and
column_name = article;
/*
** Insert into table document using char array
*/
fd = open("c:\users\jchang\textdata\texttst1", O_RDWR);
in_article.array= (char *) malloc(column_len);
in_article.file_used= 0;
ret_status= read(fd, in_article.array, column_len);
if (ret_status > 0)
{
in_article.array_size= ret_status;
}
else
{
return;
}
id=0;
strcpy(name,"Southern Living");
/*
** Prepare & execute the static insert statement
*/
exec sql insert into document(id, name, article)
values(:id, :name, :in_article);
/*
** Print the size inserted
*/
printf("The size inserted %d\n", in_article.input_len);
/*
** Select from table document using char array
*/
out_article.array= (char *) malloc(column_len);
out_article.file_used= 0;
exec sql select article into :out_article
from document where id = 0;
/*
** Print the size selected
*/
printf("The size selected %d\n", out_article.output_len);
return;
error:
exec sql whenever sqlerror continue;
exec sql report error into :err_ptr;
puts(err_ptr);
exit();
}
The describe SQL statement does not return the actual length of the text
column in the sqllen field of the sqlvar structure. RIS sets sqllen to the size of
the ris_text structure. You must query the ris5columns dictionary table to get
the actual length of the text column.
<stdio.h>
<fcntl.h>
<errno.h>
"ris.prt"
i;
*blobcol;
*textcol;
/*
** Define exception handlers
** i.e., if SQL error detected goto label error
**
if no more rows detected goto label not_found
*/
exec sql whenever sqlerror goto :error;
exec sql whenever not found goto :not_found;
3 - 10
/*
** Default to schema sch1 (static SQL with no parameters)
*/
printf("Default to schema sch1\n");
exec sql default schema sch1 ;
/*
** Insert into table employee (dynamic SQL with known parameters)
*/
strcpy(sql_stmt, "insert into employee (id, name, picture)
values(?,?,?)");
/*
** Prepare the dynamic insert statement
*/
printf("Prepare insert statement stmt1\n");
exec sql prepare stmt1 from :sql_stmt;
id = 1008;
strcpy(name,"Bob Shorty");
#if defined(WIN32) || defined(DOS) || defined(WIN32S)
picture.filename = "C:\\users\\hpatel\\blob\\net.msg";
#else
picture.filename = "/usr2/risapp/blob/utl.msg";
#endif
picture.file_used = 1; /* picture data from a file */
/*
** Now, execute the dynamic insert statement
*/
printf("Execute stmt1\n");
exec sql execute stmt1 using :id, :name, :picture;
/*
** Clear the dynamic insert statement
*/
exec sql clear stmt1;
/*
** Update table employee (dynamic SQL with known parameters)
*/
strcpy(sql_stmt, "update employee set picture = ?
where name = Bob Shorty");
/*
** Prepare the dynamic update statement
*/
printf("Prepare update statement stmt2\n");
exec sql prepare stmt2 from :sql_stmt;
#if defined(WIN32) || defined(DOS) || defined(WIN32S)
picture.filename = "C:\\users\\hpatel\\blob\\utl.msg";
#else
picture.filename = "/usr2/risapp/blob/utl.msg";
#endif
3 - 12
out_desc.sqlvar[i].sqldata =
calloc(1, sizeof(ris_blob));
blobcol = (ris_blob *) out_desc.sqlvar[i].sqldata;
blobcol->array
= calloc(1, MAX_MEM_SIZE);
blobcol->array_size = MAX_MEM_SIZE;
blobcol->file_used = 0;
}
else
{
out_desc.sqlvar[i].sqldata =
calloc(1, out_desc.sqlvar[i].sqllen);
}
out_desc.sqlvar[i].sqlind = (long*)calloc(1, sizeof(long));
out_desc.sqlvar[i].sqlnull = 1;
}
/*
** Declare a cursor curs1 for select statement
*/
printf("Declare cursor for stmt3\n");
exec sql declare curs1 cursor for stmt3;
/*
** Open cursor curs1
*/
printf("Open cursor for stmt3\n");
exec sql open curs1;
for (;;)
{
/*
** Fetch a row of output
*/
printf("Fetch from cursor\n");
exec sql fetch curs1 using descriptor out_desc;
/*
** print all columns of the recently fetched row
*/
3 - 14
default:
printf("error: unknown output RIS data type");
break;
}
}
printf("\n");
}
not_found:
exec sql whenever not found continue;
printf("No more data\n");
exec sql clear stmt3;
return;
error:
exec sql whenever sqlerror continue;
exec sql report error into :err_ptr;
puts(err_ptr);
exit();
}
__________________________________________________________________________________________________________________________________________________
4-2
4.
__________________________________________________________________________________________________________________________________________________
begin declare
exec sql begin declare section;
clear
exec sql clear { <statement-id> | {cursor <cursor>} };
clear async
exec sql clear async <:async_id>;
close
exec sql close <cursor>;
declare cursor
exec sql declare <cursor> cursor
for { <select-statement> | <statement-id> };
4-4
define
exec sql define <name> [ <integer> ];
describe
exec sql describe { input | output } <statement-id> using descriptor <sqlda>;
else
exec sql else;
end declare
exec sql end declare section;
endif
exec sql endif;
execute
exec sql execute <statement-id>
[ using { descriptor <sqlda> } | <host variables> ];
execute immediate
exec sql execute immediate <string>;
fetch
exec sql fetch <cursor> into <host variables>;
OR
exec sql fetch <cursor> using descriptor <sqlda>;
ifdef
exec sql ifdef <name>;
ifndef
exec sql ifndef <name>;
include
exec sql include { <filename> | "<filename>" };
open
exec sql open <cursor> [ using
prepare
exec sql prepare <statement-id> from <string>;
report error
exec sql report error [ for async <:async_id> ] into <char_ptr>;
select into
exec sql select <column-list> into <host variables>
from ... [ where ... ];
sql
exec sql <sql statement>;
test completion
exec sql test { <:async1>, <:async2>, ... | all | any | using
descriptor <desc1> } completion;
undef
exec sql undef <name>;
wait completion
exec sql wait { <:async1>, <:async2>, ... | all | any | using
descriptor <desc1> } completion;
whenever
exec sql whenever { not found | sqlerror }
{ continue | {goto <C label>} | {go to <C label>} };
4-6
extern.rc
multiple.rc
static.rc
transact.rc
blob1.rc
blob2.rc
loccli.rc
sharedic.rc
secure.rc
union.rc
setup.rc
cleanup.rc
async
The async statement executes any RIS SQL statement asynchronously. An async_id
must be associated with each statement.
exec sql async <:async_id>
Examples
_________
exec sql async :async_id execute immediate "create table t1 (c1 int)";
exec sql async :async_id insert into table t1 values (1);
See
Also
________
Asynchronous Execution of Statements
4-8
begin declare
The begin declare statement marks the beginning of the variable declaration section
of the program to the preprocessor. Define and declare all host variables used in SQL
statements within a declaration section. You must terminate a declare section with
the end declare statement.
exec sql begin declare section;
Examples
_________
struct anystruct sa[10];
exec sql begin declare section;
int i,j;
char buf[20];
virtual int sa_element as sa[i].element;
exec sql end declare section;
begin declare must be specified at the beginning of a block of code before any
executable statements. In the declare section, use only variables in Embedded SQL
statements. Place all other local variables immediately before or after the declare
section.
Notes
_ ____
The RIS preprocessor supports the following C language data types:
int (4 bytes)
short (2 bytes)
float
double
char*
char[ ]
char[ ] is NULL-terminated by RIS if there is enough room in the array.
The RIS preprocessor also supports the following structures:
blob
datetime
sqlda
text
See Also
________
end declare
clear
The clear statement frees all memory for a dynamically prepared statement or a
cursor. The cursor is rendered useless. Once a statement is cleared, it cannot be
used again. Once a cursor has been cleared, it cannot be reopened. Clearing an open
cursor causes the cursor to close and a commit is forced.
exec sql clear { <statement-id> | {cursor <cursor>} };
Examples
_________
exec sql clear stmt1;
exec sql clear cursor c1;
Notes
_ ____
Clearing the statement and clearing the cursor declared for it have the same effect.
It is not necessary to clear both. If an attempt is made to clear both the statement
and the cursor, an error is returned indicating the use of an invalid statement ID.
See
Also
________
close
declare cursor
execute
execute immediate
open
prepare
4 - 10
clear async
The clear async statement frees the additional memory allocated for the
asynchronous ID.
exec sql clear async <:async_id>;
Examples
_________
exec sql clear async :async1;
Notes
_ ____
Clearing async ID is different from clearing a RIS statement. Clearing asynchronous
ID does not clear the RIS statement and vice versa.
close
The close statement closes a cursor. The cursor can be reopened with the open
statement or cleared with the clear statement.
exec sql close <cursor>;
Examples
_________
exec sql close c1;
Notes
_ ____
RIS automatically closes all cursors if a commit or rollback statement is issued or an
error occurs during the execution of any DML statement. In autocommit mode,
closing a cursor causes a commit to occur. This then closes all other cursors.
See
Also
________
clear
declare cursor
fetch
open
4 - 12
declare cursor
The declare cursor statement declares a cursor work area for use by a static or
dynamic select statement.
exec sql declare <cursor> cursor
for { <select-statement> | <statement-id> };
Keyword/Identifier
__________________
Description
___________
<select-statement>
Valid SQL select statement that selects data into the cursor.
Use parameters within the select statement for values in the
where clause or the having clause. For more information, see
the select statement description in the RIS SQL Users Guide.
<statement-id>
Examples
_________
exec sql declare c1 cursor for select * from tab1;
exec sql declare c1 cursor for stmt1;
Notes
_ ____
You do not need a cursor for the special select into statement.
If the select statement only retrieves one row of data, use the more simple embedded
select into statement instead of the declare, open, and fetch sequence of statements.
See Also
________
clear
close
fetch
open
prepare
select into
define
The define statement assigns a compile-time value to a name. This assignment
occurs during the RIS preprocessing stage. In the statement with a normal C
preprocessor #define.
exec sql define <name> [<integer>];
Examples
_________
exec sql define MAX_ID;
exec sql define MIN_ID 10;
Notes
_ ____
The define statement defines only integer constants. It does not support definition of
string constants or parameterized macros.
See
Also
________
else
endif
ifdef
ifndef
include
undef
4 - 14
describe
The describe statement returns information about the input parameters or the output
results of a dynamic SQL statement. This information is returned in a structure of
type sqlda (defined in the file ris.h).
exec sql describe { input | output } <statement-id> using descriptor <sqlda>;
Examples
_________
exec sql describe input s1 using descriptor in_sqlda;
exec sql describe output s1 using descriptor out_sqlda;
Notes
_ ____
When you execute a dynamic SQL statement, you must provide a single sqlda
structure and an array of sqlvar structures (one structure for each input or output
parameter). For example, the following statement needs one sqlda structure for
output and three sqlvar structures for the output variables a, b, and c. The
statement also needs one sqlda structure for input plus one sqlvar structure for the
input variable d.
select a,b,c from t1 where d = ?
For input parameters, the describe statement looks for the question marks in the
value list in the where clause and assignment list in the update statement. For
output parameters, the describe statement looks for the column names in the select
statement.
sqlda Structure
Field
_____
Description
___________
short
sqln
short
sqld
struct sqlvar
*sqlvar
sqlvar Structure
The sqlvar structure consists of the following fields:
Data
Type
__________
Field
_____
Description
___________
char
*sqldata
long
*sqlind
short
sqltype
short
sqlnull
short
short
sqllen
sqlscale
sqlname
4 - 16
The sqlname field is a nested structure which consists of the following fields:
Data
Type
__________
Field
_____
Description
___________
short
char
sqlnamel
sqlnamec[34]
You can use the describe statement to set up the sqlda and sqlvar structures by
following these steps:
1.
Using malloc, allocate an sqlda structure, but do not fill in the sqld field.
in_sqlda = (sqlda *)malloc(sizeof(sqlda));
out_sqlda = (sqlda *)malloc(sizeof(sqlda));
2.
RIS sets the sqld field to the number of sqlvar structures needed.
3.
Allocate the array of sqlvar structures and set up the sqlda structure.
in_sqlda->sqln = in_sqlda->sqld;
in_sqlda->sqlvar = (sqlvar *)malloc(sizeof(sqlvar)*in_sqlda->sqln);
out_sqlda->sqln = out_sqlda->sqld;
out_sqlda->sqlvar = (sqlvar *)malloc(sizeof(sqlvar)*out_sqlda->sqln);
4.
RIS sets the fields in the sqlvar structures for each of the SQL variables.
If you already know which fields need modifying, skip this step and directly
modify those fields. You can modify the following fields:
sqlnull: set this field to a nonzero value if you want to allow NULL values.
sqlind: if sqlnull is nonzero, set this field to the address of an indicator
variable (long integer). A negative number indicates a NULL value.
sqltype: set this field to a SQL type that is equivalent to the C program
variable type.
If you have not already, modify the sqldata and sqlind fields in the sqlvar
structure.
in_sqlda->sqlvar[0]->sqldata = &my_data;
in_sqlda->sqlvar[0]->sqlind = &my_indicator;
out_sqlda->sqlvar[0]->sqldata = &my_data;
out_sqlda->sqlvar[0]->sqlind = &my_indicator;
You can specify the following keywords with the describe statement:
Keyword/Identifier
__________________
Description
___________
output
RIS sets sqltype to the data type, sqllen to the length, and
sqlname to the column name, in the sqlvar structures. You
must set the sqldata and sqlind fields. If the SQL statement
is not a select statement, RIS sets sqld to zero (0).
input
RIS sets sqltype to the expected data type, and sqllen to the
length, in the sqlvar structures. You can use a different type
and length of variable, but this may cause a data conversion
error. Most numeric types are interchangeable, but character
types and numeric types cannot be interchanged.
The value returned in the sqllen field for character columns is the
maximum length of character data. Since C strings are null terminated,
allocate one extra byte to hold the null terminator. Otherwise, the data
may be truncated.
4 - 18
else
The else statement, used with ifdef or ifndef, controls substitution of C code during
the RIS preprocessing stage. If the ifdef or ifndef condition fails, riscpp.exe
substitutes code following the else command with C code for compilation.
exec sql else;
Examples
_________
exec sql ifdef MAX_ID;
printf("MAX_ID is defined\n");
exec sql else;
printf("MAX_ID is not defined\n");
exec sql endif;
Notes
_ ____
Use only one else statement for every ifdef or ifndef statement.
See
Also
________
define
endif
ifdef
ifndef
include
undef
end declare
The end declare statement informs the preprocessor that a variable declaration
section is ending.
exec sql end declare section;
See Also
________
begin declare
4 - 20
endif
The endif statement is the required ending for every ifdef or ifndef statement.
exec sql endif;
Examples
_________
exec sql ifdef MAX_ID;
exec sql endif;
Notes
_ ____
Use only one endif statement for every ifdef or ifndef statement.
See
Also
________
define
else
ifdef
ifndef
include
undef
execute
The execute statement executes a dynamic noncursor SQL statement against a
database. Use the using clause only if there are input parameters in the prepared
statement. See the describe statement for more information about input parameters.
exec sql execute <statement-id> [ <using clause> ];
Keyword/Identifier
__________________
Description
___________
statement-id
using clause
Examples
_________
exec sql execute stmt1;
exec sql execute stmt1 using :input1, :input2;
exec sql execute stmt1 using :input1:ind1, :input2:ind2;
exec sql execute stmt1 using descriptor in_sqlda;
Notes
_ ____
The execute statement is valid only on previously prepared statements and must be
used on the same schema used to prepare the statement.
If there are no input parameters, use the execute immediate statement instead.
The execute statement is not valid for dynamic cursor statements. Use the open
statement instead.
See
Also
________
clear
describe
execute immediate
prepare
4 - 22
execute immediate
The execute immediate statement executes a dynamic noncursor SQL statement
against a database. This statement cannot have any input parameters. Use the
prepare and execute statements if input parameters are required. Use the open
statement for dynamic cursor statements.
exec sql execute immediate <string>;
Keyword/Identifier
__________________
Description
___________
<string>
Examples
_________
exec sql execute immediate :sql_string;
exec sql execute immediate "insert into t1 values (1,2)";
Notes
_ ____
The execute immediate statement is the same as executing the prepare and execute
statements on a dynamic statement without input parameters.
To improve performance of execute immediate statements executed multiple times,
split the statement into the equivalent prepare and execute statements. Next, issue
the prepare statement only once and issue the execute statement multiple times. This
checks the syntactic correctness of the SQL statement only once. For more
information, see the section Preparing Statements.
See
Also
________
clear
execute
prepare
fetch
The fetch statement retrieves one row of results from a cursor select statement.
exec sql fetch <cursor> into <host variables>;
OR
exec sql fetch <cursor> using <using clause>;
Keyword/Identifier
__________________
Description
___________
<host variables>
<using clause>
Examples
_________
fetch c1 into :output1, :output2;
fetch c1 into :output1:ind1, :output2:ind2;
fetch c1 using descriptor out_sqlda;
4 - 24
Notes
_ ____
When retrieving character data (strings), RIS null-terminates the string only if there
is sufficient space in the character data buffer.
RIS automatically closes all cursors if a commit or rollback statement is
issued or an error occurs during the execution of any DML statement.
See Also
________
clear
close
declare cursor
describe
open
ifdef
The ifdef statement controls substitution of C code during the RIS preprocessing
stage. If the ifdef condition succeeds, riscpp.exe substitutes the code between the
ifdef and endif statements with C code for compilation.
exec sql ifdef <name>;
Examples
_________
exec sql ifdef MAX_ID;
printf("MAX_ID is defined\n");
exec sql endif;
Notes
_ ____
Every ifdef statement must have a matching endif statement. You can nest the ifdef
statement. You can also have embedded else statements.
See
Also
________
define
else
endif
ifndef
include
undef
4 - 26
ifndef
The ifndef statement controls substitution of C code during the RIS preprocessing
stage. If the ifndef condition succeeds, riscpp.exe substitutes the code between the
ifndef and endif statements with C code for compilation.
exec sql ifndef <name>;
Examples
_________
exec sql ifndef MAX_ID;
printf("MAX_ID is not defined\n");
exec sql endif;
Notes
_ ____
Every ifndef statement must have a matching endif statement. You can nest the
ifndef statement. You can also have embedded else statements.
See
Also
________
define
else
endif
ifdef
include
undef
include
The include statement includes a source file at a specified point in the .c file. This
occurs during the RIS preprocessing stage.
If the specified filename does not exist in the local directory, riscpp.exe looks in the
include directory search paths given by the -I option.
exec sql include {<filename> | "<filename>"};
Examples
_________
exec sql include "filename";
exec sql include filename;
exec sql include "/usr/my_app/filename";
exec sql include /usr/my_app/filename;
Notes
_ ____
You can nest the include statement.
Quotation marks around pathnames are optional.
See
Also
________
define
else
endif
ifdef
ifndef
undef
4 - 28
open
The open statement executes the select statement and sets up a cursor for fetching.
exec sql open <cursor> [ <using clause> ];
Keyword/Identifier
__________________
Description
___________
<using clause>
Examples
_________
exec sql open cl;
exec sql open c1 using :input1, :input2;
exec sql open c1 using :input1:ind1, :input2:ind2;
exec sql open c1 using descriptor in_sqlda;
Notes
_ ____
The open statement opens a static or dynamic cursor, executing the declared SQL
statement against a database. The open statement is only valid for cursors
previously declared with the declare statement.
RIS automatically closes all cursors if a commit or rollback statement is
issued or an error occurs during the execution of any DML statement.
See Also
________
clear
close
declare cursor
describe
prepare
The prepare statement prepares a dynamic SQL statement for later use. Preparing a
statement checks the statement for proper syntax and initializes the structures to be
used during statement execution.
exec sql prepare <statement-id> from <string>;
Keyword/Identifier
__________________
Description
___________
<statement id>
<string>
Examples
_________
exec sql prepare c1 from "select * from tab1 where tab1.col1 = ?";
char_ptr = "select * from tab1 where tab1.col1 = ?";
exec sql prepare c1 from :char_ptr;
char_ptr = "insert into tab1 (col1) values (?);
exec sql prepare c1 from :char_ptr;
char_ptr = "delete from tab1 where col1 = ?";
exec sql prepare c1 from :char_ptr;
strcpy (char_array,"update tab1 set col1 = ? where col1 = ?");
exec sql prepare c1 from :char_array;
Notes
_ ____
Once a noncursor statement is prepared, it can be executed numerous times. Use the
execute statement to execute it. The same schema used to prepare the statement
must be used to execute the statement.
After a cursor statement is prepared, it must be declared and opened using the
declare and open statements. Once the statement is prepared and declared, it can be
opened numerous times.
Use parameters, designated by a question mark (?), for values in the where clause or
for values in the insert, update, and delete statements.
See
Also
________
clear
execute
execute immediate
4 - 30
report error
The report error statement retrieves the message resulting from the last error. It
returns a pointer to the message buffer in the address specified by the <char_ptr>
identifier. If an asynchronous ID is given then the error message retrieved pertains
to the statement associated with the asynchronous ID.
exec sql report error [for async <:async_id>] into <char_ptr>;
Keyword/Identifier
__________________
Description
___________
<char_ptr>
Examples
_________
exec sql report error into :ptr;
See
Also
________
whenever
select into
The select into statement is a noncursor version of select. This statement retrieves
one row from a relation in the database. The selection criteria (specified in the where
clause) must match only one row. If more than one match is found, an error is
returned. Executing a select into statement multiple times retrieves the same row
multiple times.
exec sql select <column-list> into <host variables>
from ... [ where ... ];
Examples
_________
exec sql select column1, column2
into :output1, :output2 from table1;
exec sql select column1, column2
into :output1, :output2 from table1
where table1.column3 = :input1;
exec sql select column1, column2
into :output1:ind1, :output2:ind2 from table1;
Notes
_ ____
To select multiple rows from a relation, use a cursor select statement.
Use host variables in the into clause and for values in the where clause or the having
clause.
When retrieving character data (strings), RIS null-terminates the string only if there
is sufficient space in the character data buffer.
If select into statement is executed in autocommit mode, it causes a commit to occur.
This closes all open cursors.
See Also
________
select statement
4 - 32
sql
This statement executes a static SQL statement. The <SQL statement> clause can be
any SQL statement other than the select statement. You must declare, open, and
fetch all select statements using the declare, open, and fetch statements.
exec sql <sql statement>;
Examples
_________
exec sql default schema jim;
exec sql insert into table1 values(1, abc, 2.0);
exec sql insert into table1 values(:val1, :val2, :val3);
exec sql insert into table1 select a, b, c from table2 where d = :val4;
exec sql update table1 set column1 = 1, column2 = abc;
exec sql update table1 set column1 = :val1, column2 = :val2;
Notes
_ ____
See the SQL statement descriptions in the RIS SQL Reference Manual for more
information on the supported SQL statements.
RIS attempts to keep static SQL statements prepared as long as possible. You can
configure the number of static statements RIS keeps prepared in the RIS parameters
file. RIS automatically clears static statements when necessary. For more
information, see the section Preparing Statements.
Host variables can be used in the following Embedded SQL statements:
insert In the values list or in the select list, or values in the where clause of
the select statement.
update In the assignment expressions or for values in the where clause.
delete For values in the where clause.
See
Also
________
execute immediate
test completion
The test completion statement returns the status of a RIS statement being executed
asynchronously. The status can be complete, incomplete, or fail.
exec sql test { <:async1>, <:async2>, ... | all | any | using
descriptor <desc1> } completion;
The test completion statement can be performed on a specific asynchronous ID, a list
of asynchronous IDs, all the active asynchronous IDs, or by using a descriptor which
can specify a list of asynchronous IDs.
The following is a list of the four possible status states and their descriptions:
Keyword/Identifier
__________________
Description
___________
RIS_SUCCESS
END_OF_DATA
STATEMENT_FAILED
STATEMENT_NOT_COMPLETE
STATEMENT_NOT_COMPLETE status is
returned if RIS is still processing the
statement. SQLCODE is set to
STATEMENT_NOT_COMPLETE.
The first three states are referred to as complete states while the fourth state is
referred to as an incomplete state.
These options give the application the flexibility to test for specific asynchronous IDs.
The status returned depends upon the option specified.
If one of the statements in the list of asynchronous IDs is incomplete, the test
completion statement returns STATEMENT_NOT_COMPLETE status. If all the
statements are successfully completed (that is RIS_SUCCESS state only), it returns
RIS_SUCCESS. The following is the precedence of status returned:
STATEMENT_NOT_COMPLETE ( highest priority )
STATEMENT_FAILED
END_OF_DATA
RIS_SUCCESS ( lowest priority )
4 - 34
The any clause returns the status of the first statement found in a complete state
(RIS_SUCCESS, END_OF_DATA, or STATEMENT_FAILED). Otherwise it returns
STATEMENT_NOT_COMPLETE. The remaining statements must be tested or an
error is returned.
Examples
_________
exec sql test all completion;
exec sql test :async1, :async2, :async3 completion;
exec sql test any completion;
int async_ids[2];
sqlvar in_sqlvar[2];
exec sql begin declare section;
sqlda in_sqlda;
exec sql end declare section;
async_ids[0] = 10; /*asynchronous id 10 */
async_ids[1] = 11; /*asynchronous id 11 */
in_sqlvar[0].sqltype = INTEGER;
in_sqlvar[0].sqldata = (char*)&async_ids[0];
in_sqlvar[1].sqltype = INTEGER;
in_sqlvar[1].sqldata = (char*)&async_ids[1];
in_sqlda.sqln = 2;
in_sqlda.sqld = 2;
in_sqlda.sqlvar = in_sqlvar;
exec sql test using descriptor in_sqlda completion;
Notes
_ ____
Executing test completion on an asynchronous statement that was already
successfully completed (in any one of the complete states), returns the error An
asynchronous statement has not been specified.
undef
The undef statement removes a defined name. This occurs during the RIS
preprocessing stage. In the .c file, riscpp.exe substitutes the undef statement with a
normal C preprocessor #undef.
exec sql undef <name>;
Examples
_________
exec sql undef MAX_ID;
See
Also
________
define
else
endif
ifdef
ifndef
include
4 - 36
wait completion
The wait completion statement waits for the completion of the asynchronous
statements.
exec sql wait { <:async1>, <:async2>, ...| all | any | using
descriptor <desc1> } completion;
The wait completion statement ID is identical to the test completion statement except
that there is no STATEMENT_NOT_COMPLETE return status.
Examples
_________
exec sql wait all completion;
exec sql wait :async1, :async2, :async3 completion;
exec sql wait using descriptor desc1 completion;
Notes
_ ____
Follow the information given for the test completion statement. The same conditions
apply for wait completion.
See Also
________
test completion
whenever
The whenever statement declares an exception (error) handler or an action to perform
when an exception occurs.
exec sql whenever { not found | sqlerror }
{ continue | goto <C label> | go to <C label> };
Keyword/Identifier
__________________
Description
___________
sqlerror
not found
continue
goto
Examples
_________
exec sql whenever sqlerror goto:error_label;
exec sql whenever not found goto:end_of_data;
exec sql whenever sqlerror continue;
Notes
_ ____
The RIS preprocessor determines the scope of a whenever statement linearly at
compile time. The scope is a function of the statements position in the source file
only.
Use caution when handling an error. Executing a clear statement or close
statement after an error has occurred may generate further errors. If a new
whenever statement has not been executed, an infinite loop may result.
See Also
________
report error
4 - 38
RIS Functions 5 - 1
RIS Functions
__________________________________________________________________________________________________________________________________________________
5-2
RIS Functions
RIS Functions 5 - 3
5.
__________________________________________________________________________________________________________________________________________________
RIS Functions
This section contains an alphabetical listing of functions supported by RIS. It also provides
reference structures to use with these functions, and a list of the include files, libraries, and
example programs needed when using RIS functions.
client_parms
typedef struct client_parms
{
char protocol;
char address[29];
char username[32];
char password[38];
short major;
short feature;
} client_parms;
datetime
typedef struct datetime
{
unsigned int second;
unsigned int minute;
unsigned int hour;
unsigned int day;
unsigned int month;
unsigned int year;
} datetime;
5-4
RIS Functions
ris_db_info
typedef struct ris_db_info
{
unsigned short dbid;
unsigned char
dtype;
char dbname[241];
struct
{
unsigned char
protocol;
char netaddr[29];
} pathways[4];
union
{
ris_ifx_info ifx;
ris_igs_info igs;
ris_ora_info ora;
ris_db2_info db2;
ris_rdb_info rdb;
ris_syb_info syb;
ris_os400_info os400;
ris_mssql_info mssql;
} info;
char
pad[3];
unsigned char ostype;
struct ris_db_info *next;
} ris_db_info;
RIS Functions 5 - 5
ris_rdb_info;
5-6
RIS Functions
ris_grantee_info
typedef struct ris_grantee_info
{
char
schname[32];
char
grantee[32];
struct ris_grantee_info *next;
} ris_grantee_info;
ris_parameters
typedef struct ris_parameters
{
int shared_memory;
int max_local_servers;
int max_rows;
int max_buffer_size;
int max_static_stmts;
int max_user_stmts;
int max_secondary_schemas;
int max_transactions;
int max_tables_in_memory;
int timestamp_interval;
int initial_timeout;
int timestamp_tolerance;
int buffer_full_size;
int buffer_full_timeout;
char schema_file_protocol;
char schema_file_address[29];
char schema_file_username[32];
char schema_file_password[38];
char schema_file_filename[241];
int lock_file_retry;
char client_protocol;
char client_address[29];
char client_username[32];
char client_password[38];
short client_major;
short client_feature;
} ris_parameters;
schema_file_parms
typedef struct schema_file_parms
{
char protocol;
char address[29];
char username[32];
char password[32];
char filename[241];
} schema_file_parms;
RIS Functions 5 - 7
ris_schema_info
typedef struct ris_schema_info
{
char schname[32];
char schowner[32];
char schownpass[40];
char dictowner[32];
unsigned short secure;
unsigned short dbid;
unsigned short server_version_major;
unsigned short server_version_feature;
struct
ris_schema_info *next;
} ris_schema_info;
The functions example programs are in the \risdp\disk1 directory of the RIS Development
Platform. This directory contains the following example programs:
async1.rc
async2.rc
asynctrn.rc
blob1.rc
blob2.rc
cleanup.rc
datetime.rc
dclar.rc
dynamic.rc
extern.rc
loccli.rc
multiple.rc
secure.rc
sharedic.rc
setup.rc
static.rc
transact.rc
union.rc
For details about using these example programs, see the readme.spl file in the \risdp\disk1
directory.
5.3 Functions
The following reference section provides detailed descriptions of each RIS function.
5-8
RIS Functions
RISascii_to_datetime
RISascii_to_datetime converts an ASCII string to a datetime structure. It accepts an
ASCII buffer as input and fills in a datetime structure format. Format is interpreted
in the same way as in RISdatetime_to_ascii.
char * RISascii_to_datetime( datetime *date,
char *buffer,
char *format );
Keyword/Identifier
__________________
Description
___________
date
buffer
format
Examples
_________
See examples for RISdatetime_to_ascii.
Status Returns
______________
Success
Failure
See Also
________
RISdatetime_to_ascii
0
Pointer to an error string
RIS Functions 5 - 9
RISdatetime_to_ascii
RISdatetime_to_ascii accepts a datetime structure as input and generates a nullterminated ASCII string in buffer-based format.
int RISdatetime_to_ascii( datetime *date,
char *buffer,
char *format );
Keyword/Identifier
__________________
Description
___________
date
buffer
format
Examples
_________
Assume the datetime structure contains the following:
date.year = 1990
date.month = 12
date.day = 5
date.hour = 10
date.minute = 33
date.second = 32
format = "<m/d/y>"
buffer = "<12/5/1990>"
format = "mm/dd/yy"
buffer = "12/05/90"
format = "mm/dd/yyyy"
buffer = "12/05/1990"
format = "dy, mon d yyyy"
buffer = "wed, dec 5 1990"
format = "day, month d yyyy"
buffer = "wednesday, december 5
1990"
1990"
5 - 10
RIS Functions
1990"
1990"
Status Returns
______________
Success
Failure
0
Non-zero value
RIS Functions 5 - 11
Notes
_ ____
The datetime structure is defined as follows:
typedef struct datetime
{
unsigned int
unsigned int
unsigned int
unsigned int
unsigned int
unsigned int
} datetime;
second;
minute;
hour;
day;
month;
year;
Unit
_____
Format
_______
Padding
________
yyyy
Year
Four digits.
Leading zeros.
yy
Year
Leading zeros.
Year
None.
mm
Month
Two digits.
Leading zeros.
Month
No padding.
month
Name of month
None.
mon
Name of month
Three character
abbreviation.
None.
ddd
Day of year
None.
dd
Day of month
Two digits.
Leading zeros.
Day of month
None.
day
Day of week
name
None.
dy
Day of week
name
Three character
abbreviation.
None.
hh24
24 hour mode
Two digits.
Leading zeros.
h24
24 hour mode
None.
h12 or hh
12 hour mode
Two digits.
Leading zeros.
5 - 12
RIS Functions
h12 or h
12 hour mode
None.
nn
Minute
Two digits.
Leading zeros.
Minute
None.
ss
Second
Two digits.
Leading zeros.
Second
None.
am or pm
Meridian
indicator
Two characters.
None.
ASCII
string
____________
Unit
_____
Format
_______
Padding
________
a.m. or p.m.
Meridian
indicator with
periods
Four characters.
None.
text
Single
quotation
string
Reproduced in destination
string.
None.
Single
quotation
Reproduced in destination
string.
None.
default
Any other
character
Reproduced in destination
string.
None.
RIS Functions 5 - 13
RISget_ansi_mode
RISget_ansi_mode checks if ANSI mode flag is on or off. If it is on, ANSI mode is set
to one. Otherwise, it is zero. If ANSI mode is on, RIS restricts user-supplied names
for schemas, tables, columns, views, and indexes to a maximum of 18 characters
while they are created. If ANSI mode is off, the RIS limit is extended to 31
characters. ANSI mode is set using the set mode statement.
void RISget_ansi_mode( int *ansi_mode );
Keyword/Identifier
__________________
Description
___________
ansi_mode
Examples
_________
main()
{
int *ansi_mode;
RISget_ansi_mode(&ansi_mode);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (ansi_mode)
{
printf("ANSI mode flag is ON.\n");
printf("RIS restricts user_supplied names
to 18 characters.\n");
}
else
printf("ANSI mode is OFF\n");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
Notes
_ ____
Not every DBMS can handle names longer than 18 characters.
5 - 14
RIS Functions
RISget_app_version
RISget_app_version gets the current version of RIS. The pointer arguments: maj,
min, and rel are set by RIS.
void RISget_app_version( int *maj,
int *min,
int *rel );
Keyword/Identifier
__________________
Description
___________
maj
min
rel
Examples
_________
main()
{
int *maj,*min,*rel;
RISget_app_version(&maj,&min,&rel);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
printf("Application Major
: %d \n", maj);
printf("Application Minor
: %d \n", min);
printf("Application Release : %d \n", rel);
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
RIS Functions 5 - 15
RISget_async_stmts
RISget_async_stmts gets the number of asynchronous statements and their IDs. The
buffer is an array of asynchronous IDs. To determine the size of the buffer, call
RISget_async_stmts with *countp equal to zero. On input, *countp sets the number of
async IDs to return. On output, *countp contains the number of async IDs that exist.
You can call RISget_async_stmts a second time with *countp set to the number of
async IDs. This retrieves the async IDs.
void RISget_async_stmts( int *buffer,
int *countp );
Keyword/Identifier
__________________
Description
___________
buffer
countp
Examples
_________
#include "rislimit.h"
main()
{
int count;
int *buffer;
int i;
exec sql begin declare section;
int async1;
int async2;
char * err_ptr;
exec sql end declare section;
exec sql whenever sqlerror goto :error;
exec sql whenever not found goto :not_found;
exec sql default schema sch1;
exec sql async :async1 insert into t1 values (1);
exec sql default schema sch2;
exec sql async :async2 insert into t2 values (2);
exec sql wait :async1 completion;
exec sql wait :async2 completion;
5 - 16
RIS Functions
/*
** Find out how many asynchronous statements.
*/
count = 0;
RISget_async_stmts(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :err_ptr;
printf("%s", err_ptr);
return SQLCODE;
}
/*
** Allocate the space to hold the asynchronous IDs.
*/
buffer = (int *) malloc (count * sizeof(int));
/*
** Retrieve the async IDs
*/
RISget_async_stmts(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :err_ptr;
printf("%s", err_ptr);
return SQLCODE;
}
/*
** Output the results
*/
for(i = 0; i < count; i++)
{
printf("buffer[%d]=%d\n", i, buffer[i]);
}
exec sql clear async :async1;
exec sql clear async :async2;
not_found:
exec sql whenever not found continue;
printf("No more data\n");
exit();
error:
exec sql whenever sqlerror continue;
exec sql report error into :err_ptr;
puts(err_ptr);
exit();
}
RIS Functions 5 - 17
RISget_autocommit_mode
RISget_autocommit_mode checks if autocommit mode is on or off. If it is on,
autocommit is set to one. Otherwise, it is zero. When autocommit is on, data
manipulation statements such as select, insert, update, and delete are automatically
committed. The set transaction statement sets the transaction state.
void RISget_autocommit_mode( int *autocommit );
Keyword/Identifier
__________________
Description
___________
autocommit
Examples
_________
main()
{
int *autocommit;
RISget_autocommit_mode(&autocommit);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (autocommit)
{
printf("Autocommit mode flag is ON.\n");
printf("Data manipulation statements are
automatically committed.\n");
}
else
printf("Autocommit mode is OFF \n");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
5 - 18
RIS Functions
RISget_autorename_mode
RISget_autorename_mode checks if the autorename mode is on or off. If it is on,
autorename is set to one and RIS regenerates the column and table names (greater
than the ten characters) originally supplied by the user. If it is off, autorename is set
to zero and RIS will not regenerate column and table names. The autorename mode
is set using the set mode statement.
void RISget_autorename_mode( int *autorename );
Keyword/Identifier
__________________
Description
___________
autorename
Examples
_________
main()
{
int *autorename_mode;
RISget_autorename_mode(&autorename_mode);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (autorename_mode)
{
printf("Autorename mode flag is ON.\n");
printf("RIS will regenerate table/column names > than\n");
printf("ten characters in length\n");
}
else
printf("Autorename is OFF \n");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
RIS Functions 5 - 19
RISget_blankstrip_mode
RISget_blankstrip_mode checks if the blankstrip mode is on or off. If it is on,
blankstrip_mode is set to one and RIS strips trailing blanks from character data. If it
is off, blankstrip_mode is set to zero and RIS does not strip trailing blanks. The
blankstrip mode is set using the set mode statement.
void RISget_blankstrip_mode( int *blankstrip_mode );
Keyword/Identifier
__________________
Description
___________
blankstrip_mode
Examples
_________
main()
{
int *blankstrip_mode;
RISget_blankstrip_mode(&blankstrip_mode);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (blankstrip_mode)
{
printf("Blankstrip mode flag is ON.\n");
printf("RIS will strip trailing blanks
from character data \n");
}
else
printf("Blankstrip mode is OFF \n");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
5 - 20
RIS Functions
RISget_client_location
RISget_client_location retrieves the location of the RIS client process specified in the
parameters file.
void RISget_client_location( client_parms *parms );
Keyword/Identifier
__________________
Description
___________
parms
Examples
_________
main()
{
client_parms parms;
RISget_client_location(&parms);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
printf("Protocol : %c \n", parms.protocol);
printf("Address : %s \n", parms.address);
printf("Major
: %d \n", parms.major);
printf("Feature : %d \n", parms.feature);
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
The protocol field in the client_parms structure specifies the protocol interacting with
the node where the RIS client process resides. The protocols and their corresponding
codes are:
Protocol
Code
xns
tcp/ip
decnet
memory(local)
X
T
D
M
RIS Functions 5 - 21
The address field specifies the address of the node. The protocols and their
corresponding address formats are:
Protocol
Code
xns
tcp/ip
decnet
memory(local)
name or XXXXXXXX.XX-XX-XX-XX-XX-XX
name or XXX.XXX.XXX.XXX
name or XX.XXXX
INVALID
Use the major field in the client_parms structure to specify the major version of the
client and the feature field to specify the feature version of the client. The major
version of the client should be greater than or equal to the major version of the
application.
The major client version default and the feature client default is zero. Use these
defaults when the client version is the same as the application version.
RIS for Windows NT currently supports only the TCP/IP protocol.
5 - 22
RIS Functions
RISget_current_stmt_schema_name
RISget_current_stmt_schema_name retrieves the schema name associated with the
last RIS statement executed but not cleared. The buffer is an array of character
strings of size RIS_MAX_ID_SIZE, defined in the rislimit.h include file, with the
schema name.
void RISget_current_stmt_schema_name( char (buffer) [RIS_MAX_ID_SIZE] );
Keyword/Identifier
__________________
Description
___________
buffer
Examples
_________
#include "rislimit.h"
main ()
{
char buffer[RIS_MAX_ID_SIZE];
exec sql default schema sch1;
exec sql prepare s1 from "select * from ristables";
RISget_current_stmt_schema_name(buffer);
printf("schema name: <%>s\n", buffer);
}
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
RIS Functions 5 - 23
RISget_db_info
RISget_db_info gets database information from the RIS schema file. It takes a
database ID as input and places this database information into the ris_db_info
structure. The dbp pointer points to this structure. If dbp is nonzero, the structures
are allocated automatically through malloc. Otherwise, the structure is not
allocated. You must free the structures after use by calling free.
void RISget_db_info( int dbid,
ris_db_info **dbp );
Keyword/Identifier
__________________
Description
___________
dbid
dbp
Examples
_________
main()
{
ris_db_info *dbp;
exec sql begin declare section;
char *ptr;
exec sql end declare section;
RISget_db_info(2, &dbp);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :ptr;
printf("%s", ptr);
return SQLCODE;
}
printf("db info : \n\tdbid %d \n\tdtype %c
\n\tdbname <%s> \n\tprotocol %c
\n\tnetaddr <%s> \n\tifx: \n\t\tdir <%s>
\n\t\tsqlexec <%s> \n\t\tdbtemp <%s>
\n\t\ttbconfig <%s>\n\t\tostype<%c>\n",
dbp->dbid, dbp->dtype, dbp->dbname,
dbp->pathways->protocol, dbp->pathways->netaddr,
dbp->info.ifx.dir, dbp->info.ifx.sqlexec,
dbp->info.ifx.dbtemp, dbp->info.ifx.tbconfig, dbp->ostype);
free(dbp);
}
5 - 24
RIS Functions
Sample Output:
db info :
dbid 2
dtype X
dbname <inf2>
protocol T
netaddr <129.135.145.157>
ifx:
dir </usr3/informix>
sqlexec </usr3/informix/lib/sqlturbo>
dbtemp <>
tbconfig <>
ostype <>
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, a
RIS_E_CLIENT_DEAD error is returned. If database is not
found, a RISapp_UNKNOWN_DB error is returned.
RIS Functions 5 - 25
RISget_dbca
RISget_dbca returns a pointer to the risca variable (rissqla structure) containing a
copy of the vendor databases sqlca structure. For more information, see the section
Error Handling.
rissqla *RISget_dbca( void );
Keyword/Identifier
__________________
Description
___________
dbca
Examples
_________
main()
{
rissqlca *DBCA;
exec sql default schema sch1;
if(RISget_sqlcode() != RIS_SUCCESS)
{
DBCA = RISget_dbca();
printf("Database SQLCODE = %d\n", DBCA -> sqlcode);
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
5 - 26
RIS Functions
RISget_default_schema_name
RISget_default_schema_name returns the current default schema name into the
buffer variable.
void RISget_default_schema_name( char (buffer) [RIS_MAX_ID_SIZE] );
Keyword/Identifier
__________________
Description
___________
buffer
Examples
_________
#include "rislimit.h"
main ()
{
char buffer [RIS_MAX_ID_SIZE];
exec sql default schema my_schema;
RISget_default_schema_name(buffer);
printf("Default schema: %\n", buffer);
}
Status
Returns
______________
None
RIS Functions 5 - 27
RISget_enabled_databases
RISget_enabled_databases determines which RIS-supported DBMSs are enabled. If
all the databases are enabled, the bit mask RIS_ENABLE_ALL is set in
enable_dbms. If only some of the databases are enabled, the bit masks corresponding
to the enabled databases are set in enable_dbms. These bit masks are defined in
ris.h. The ris.h include file also defines macros. These macros return zero or one if
the appropriate bit is set in the bit mask. The macro names are
IS_XXX_ENABLED(mask) where XXX is the DBMS name in uppercase. For
example, IS_INFORMIX_ENABLED is the integer bit mask variable.
The set database statement specifies the types of underlying databases you can use.
This causes verification of user-supplied names against the reserved words of the
specified databases.
void RISget_enabled_databases( int *enable_dbms );
Keyword/Identifier
__________________
Description
___________
enable_dbms
Examples
_________
main()
{
int enable_dbms;
RISget_enabled_databases(&enable_dbms);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (IS_INFORMIX_ENABLED(enable_dbms))
printf("Informix database is enabled\n");
}
The following figure represents the integer to which enable_dbms points. The bit
masks in this graphic match those in ris.h.
5 - 28
RIS Functions
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
RIS Functions 5 - 29
RISget_language_name
RISget_language_name retrieves the language name currently set by RIS. The RISsupported languages are listed in the RIS language configuration file. See the
section Language Configuration File in the RIS SQL Users Guide for 32-Bit
Applications for more information about selecting languages.
RISget_language_name( char *name );
Keyword/Identifier
__________________
Description
___________
name
Examples
_________
#include "rislimit.h"
main()
{
char language [RIS_MAX_LANGNAME_SIZE];
RISinitialize("english");
RISget_language_name(language);
printf("Language is set to %s\n", language);
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
If RIS is not initialized, the input variable is set to the null string.
5 - 30
RIS Functions
RISget_parameters
RISget_parameters retrieves the RIS parameters currently set by RIS. The
parameters pointer points to the RIS parameter information structure.
void RISget_parameters( ris_parameters *parameters );
Keyword/Identifier
__________________
Description
___________
parameters
Examples
_________
main()
{
ris_parameters parameters;
RISget_parameters(¶meters);
printf("max_local_servers: %d\n", parameters.max_local_servers);
printf("max_local_servers: %d\n", parameters.max_rows);
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
Each field corresponds to a field specified in the parameters file.
RIS Functions 5 - 31
RISget_risca
RISget_risca returns a pointer to the risca variable (rissqla structure), which
provides consistent error and other information regardless of the database system.
For detailed information on the risca variable, see the section Error Handling.
rissqla *RISget_risca( void );
Keyword/Identifier
__________________
Description
___________
risca
Examples
_________
main()
{
rissqlca *RISCA;
exec sql default schema sch1;
if(RISget_sqlcode()!= RIS_SUCCESS)
{
RISCA = RISget_risca();
printf("SQLCODE=%d\n", RISCA -> sqlcode);
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
5 - 32
RIS Functions
RISget_schema_file
RISget_schema_file retrieves schema filename, schema, database, and grantee
information from the RIS schema file. It returns a list of information about every
schema filename, database, schema, and grantee using the schema_filenamep,
dblistp, schlistp, and granteep pointers. The structures related to these pointers are
automatically allocated through malloc. However, you must deallocate them after
use by calling free. If any of the parameters are zero, the corresponding structures
are not allocated.
void RISget_schema_file( char **schema_filenamep
ris_db_info **dblistp,
ris_schema_info **schlistp,
ris_grantee_info **granteep );
Keyword/Identifier
__________________
Description
___________
schema_filenamep
dblistp
schlistp
granteep
Examples
_________
main()
{
exec sql begin declare section;
char *ptr;
exec sql end declare section;
char *schema_filenamep;
ris_schema_info *schemap;
ris_db_info *dbp;
ris_grantee_info *granteep;
RISget_schema_file(&schema_filenamep, &dbp, &schemap, &granteep);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :ptr;
printf("%s", ptr);
return SQLCODE;
}
RIS Functions 5 - 33
while (schemap)
{
printf("schema info: \n\tname <%s>\n\tpasswd <%s>
\n\tlogin <%s>\n\tdictowner <%s>
\n\tschtype <%d>\n\tdbid %d
\n\tmajor <%d>\n\tfeature <%d>\n",
schemap->schname, schemap->schownpass,
schemap->schowner, schemap->dictowner,
schemap->secure, schemap->dbid,
schemap->server_version_major,
schemap->server_version_feature);
schemap=schemap->next;
}
while (dbp)
{
printf("db info : \n\tdbid %d \n\tdtype %c
\n\tdbname <%s> \n\tprotocol %c
\n\tnetaddr <%s> \n\tostype <%c>\n",
dbp->dbid, dbp->dtype, dbp->dbname,
dbp->pathways->protocol,
dbp->pathways->netaddr, dbp->ostype);
dbp=dbp->next;
}
while (granteep)
{
printf("grantee info : schname <%s> grantee <%s>\n",
granteep->schname, granteep->grantee);
granteep=granteep->next;
}
}
Sample
Output:
______________
schema info:
name <inf2>
user <ris>
passwd <o%2H;,w]MZpOcA%2]H;w]H-C6r_<L<Q5"W>
dbid 2
schema info:
name <inf1>
user <michal>
passwd <{<sB1SqZeP}lk07Bj9J(JQM<m)0qL7aj>
dbid 1
db info :
dbid 2
dtype X
dbname <inf2>
protocol T
netaddr <129.135.145.157>
ostype <u>
db info :
dbid 1
dtype X
dbname </usr2/michal/inf1>
protocol T
netaddr <129.135.145.76>
ostype <u>
5 - 34
RIS Functions
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, a
RIS_E_CLIENT_DEAD error is returned.
RIS Functions 5 - 35
RISget_schema_info
RISget_schema_info accepts a schema name as input and retrieves the schema
information, database information, and grantee information corresponding to
schname from the schema file. The schemap, dbp, and granteep pointers point to
schema information, database information, and a list of accessible grantees.
If schemap, dbp, or granteep is nonzero, the structure is allocated through malloc and
information is filled into its fields. If any of the parameters is zero, the structure is
not allocated. After usage, you must deallocate the structures by calling free.
void RISget_schema_info( char *schname,
ris_schema_info **schemap,
ris_db_info **dbp,
ris_grantee_info **granteep );
Keyword/Identifier
__________________
Description
___________
schname
Schema name.
schemap
dbp
granteep
Examples
_________
main()
{
exec sql begin declare section;
char *ptr;
exec sql end declare section;
ris_schema_info *schemap;
ris_db_info *dbp;
ris_grantee_info *granteep;
RISget_schema_info("inf1", &schemap, &dbp, &granteep);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :ptr;
printf("%s", ptr);
return SQLCODE;
}
while (schemap)
{
5 - 36
RIS Functions
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, RIS_E_CLIENT_DEAD
error is returned. If schema is not found,
RISapp_UNKNOWN_SCHEMA is returned.
RIS Functions 5 - 37
RISget_schema_file_location
RISget_schema_file_location retrieves the location of the RIS schema file specified in
the parameters file. The default location is in the directory where the RISCLI
product is installed.
void RISget_schema_file_location( schema_file_parms *parms );
Keyword/Identifier
__________________
Description
___________
parms
Examples
_________
main()
{
schema_file_parms parms;
RISget_schema_file_location(&parms);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
printf("Protocol : %c \n", parms.protocol);
printf("Address : %s \n", parms.address);
printf("Filename : %s \n", parms.filename);
}
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
The protocol field in the schema_file_parms structure specifies the protocol
interacting with the node where the RIS schema file resides. The protocols and their
corresponding codes are:
Protocol
Code
tcp/ip
memory(local)
T
M
The address field specifies the address of the node. The protocols and their
corresponding address formats are:
Protocol
Code
tcp/ip
memory(local)
name or XXX.XXX.XXX.XXX
INVALID
5 - 38
RIS Functions
RIS Functions 5 - 39
RISget_schema_names
RISget_schema_names retrieves the list of schema names from the RIS schema file.
RISget_schema_names reads the RIS schema file and fills in the buffer. The buffer is
an array of character strings of size RIS_MAX_ID_SIZE, defined in the rislimit.h
include file, with the names of the schemas defined in the schema file.
To determine the size of the buffer, call RISget_schema_names with *countp equal to
zero. On input, *countp sets the number of schema names to return. On output,
*countp contains the number of schemas that exist. You can then call
RISget_schema_names a second time with *countp set to the number of schema
names. This retrieves the schema names.
void RISget_schema_names( char (*buffer)[RIS_MAX_ID_SIZE],
int *countp );
Keyword/Identifier
__________________
Description
___________
buffer
countp
Examples
_________
#include "rislimit.h"
main()
{
int i;
int count;
char (*buffer)[RIS_MAX_ID_SIZE];
exec sql begin declare section;
char *ptr;
exec sql end declare section;
/*
** Find out how many schema names
*/
count = 0;
RISget_schema_names(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :ptr;
printf("%s", ptr);
return SQLCODE;
}
/*
** Allocate the space to hold the schema names
*/
buffer = (char (*)[RIS_MAX_ID_SIZE])malloc(count * RIS_MAX_ID_SIZE);
5 - 40
RIS Functions
/*
** Retrieve the schema names
*/
RISget_schema_names(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :ptr;
printf("%s", ptr);
return SQLCODE;
}
/*
** Output the results
*/
for (i = 0; i < count; i++)
printf("buffer[%d]:<%s>\n", i, buffer[i]);
}
Using the following typedef can simplify the declaration and malloc of the schema
name array.
typedef char risschema_name[RIS_MAX_ID_SIZE];
The following example is the same as the previous example, except that it uses
typedef.
#include "RISlimits.h"
typedef char risschema_name[RIS_MAX_ID_SIZE];
main()
{
int i;
int count;
risschema_name *buffer;
exec sql begin declare section;
char *ptr;
exec sql end declare section;
/*
**
*/
/*
**
*/
RIS Functions 5 - 41
/*
**
*/
/*
**
*/
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If *countp is less than the number of schema names,
SQLCODE is set to RIS_E_NOT_ENOUGH_SPACE.
5 - 42
RIS Functions
RISget_schema_transactions
RISget_schema_transactions gets the number and names of schemas involved in the
uncommitted transactions. The buffer is an array of character strings of size
RIS_MAX_ID_SIZE, defined in the rislimit.h include file, with the names of the
schemas.
To determine the size of the buffer, call RISget_schema_transactions with *countp
equal to zero. On input, *countp sets the number of schema names to return. On
output, *countp contains the number of schemas that exist. You can call
RISget_schema_transactions a second time with *countp set to the number of schema
names to retrieve the schema names currently in transaction.
void RISget_schema_transactions( char (*buffer)[RIS_MAX_ID_SIZE],
int *countp );
Keyword/Identifier
__________________
Description
___________
buffer
countp
Examples
_________
#include "rislimit.h"
main()
{
int count;
char (*buffer)[RIS_MAX_ID_SIZE];
int i;
exec sql begin declare section;
char * err_ptr;
exec sql end declare section;
exec sql whenever sqlerror goto :error;
exec sql whenever not found goto :not_found;
exec sql set transaction autocommit off;
exec sql default schema stwo;
exec sql insert into stwo.t2 values (1);
exec sql default schema sone;
exec sql insert into sone.t1 values (1);
/*
** Find out how many schemas
*/
count = 0;
RISget_schema_transactions(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :err_ptr;
RIS Functions 5 - 43
printf("%s", err_ptr);
return SQLCODE;
}
/*
** Allocate the space to hold the schema names
*/
buffer = (char (*)[RIS_MAX_ID_SIZE])malloc(count * RIS_MAX_ID_SIZE);
/*
** Retrieve the schema names
*/
RISget_schema_transactions(buffer, &count);
if (SQLCODE != RIS_SUCCESS)
{
exec sql report error into :err_ptr;
printf("%s", err_ptr);
return SQLCODE;
}
/*
** Output the results
*/
for(i = 0; i < count; i++)
{
printf("buffer[%d]:<%s>\n", i, buffer[i]);
}
exec sql commit;
exec sql default schema
exec sql commit;
stwo;
not_found:
exec sql whenever not found continue;
printf("No more data");
exit();
error:
exec sql whenever sqlerror continue;
exec sql report error into :err_ptr;
puts(err_ptr);
exit();
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If *countp is less than the number of schema
names, SQLCODE is set to RIS_E_NOT_ENOUGH_SPACE.
5 - 44
RIS Functions
RISget_ris_sqltype_code
RISget_ris_sqltype_code retrieves the RIS SQL data type code for a given RIS SQL
data type string. The RIS data type codes and their corresponding strings are listed
in the ris.h file.
void RISget_ris_sqltype_code( int *code,
char *str );
Keyword/Identifier
__________________
Description
___________
code
str
Examples
_________
main()
{
int code;
RISget_ris_sqltype_code (&code,"int");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
RIS Functions 5 - 45
RISget_ris_sqltype_string
RISget_ris_sqltype_string retrieves the RIS SQL data type string for a given RIS SQL
data type code. All data types are listed in the ris.h file.
void RISget_ris_sqltype_string( char *str,
int *code );
Keyword/Identifier
__________________
Description
___________
str
code
Examples
_________
main()
{
char str[RIS_MAX_ID_SIZE]
RISget_ris_sqltype_string(str, 2);
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
5 - 46
RIS Functions
RISget_sqlcode
RISget_sqlcode returns the last RIS error code (sqlcode). The sqlcode returned is the
most recent error code set by the previous RIS SQL statement or function call.
An application should call this function immediately after a RIS SQL statement or
RIS function call to determine the success or failure of that statement or call.
The error codes are integer size values. An sqlcode of RIS_SUCCESS (value 0)
indicates a success. Any negative value indicates a failure.
int RISget_sqlcode( void );
Examples
_________
main()
{
exec sql default schema sch1;
if(RISget_sqlcode != RIS_SUCCESS)
{
printf("Default schema failed.\n");
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
RIS Functions 5 - 47
RISget_verify_mode
RISget_verify_mode checks to see if the verify mode switch is on or off. If it is on,
verify_mode is set to one and the table and view definitions are retrieved from the
underlying database and validated against definitions stored in the RIS dictionary
tables. If it is off, verify_mode is set to zero and the validation phase is omitted. The
validation phase ensures consistency between the RIS dictionary tables and the
underlying database. The verify_mode is set using the set mode statement.
void RISget_verify_mode( int *verify_mode );
Keyword/Identifier
__________________
Description
___________
verify_mode
Examples
_________
main()
{
int *verify_mode;
RISget_verify_mode(&verify_mode);
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
if (verify_mode)
{
printf("Verify mode flag is ON.\n");
printf("Underlying database tables and view
definitions will be \n");
printf("validated against the RIS dictionary table
definitions \n");
}
else
printf("Verify mode is OFF \n");
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
5 - 48
RIS Functions
RISinitialize
RISinitialize initializes the RIS system in the following order:
1.
Initializes the language file based on the language value passed through the
language_name variable. If NULL is passed as the language, RIS uses english
as the default language. The valid languages currently supported by RIS are
listed in the RIS language configuration file. See the section Language
Configuration File in the RIS SQL Users Guide for 32-Bit Applications for more
information about selecting languages.
2.
Reads the parameters file and configures RIS according to the parameter
specifications.
3.
Keyword/Identifier
__________________
Description
___________
language_name
Examples
_________
main()
{
RISinitialize(NULL);
if(SQLCODE != RIS_SUCCESS)
{
printf("Could not initialize\n");
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
RIS Functions 5 - 49
RISlocate_client
RISlocate_client stores the location of the RIS client executable in the parameters
file.
void RISlocate_client( client_parms *parms );
Keyword/Identifier
__________________
Description
___________
parms
Examples
_________
client_parms parms;
parms.protocol = T;
strcpy (parms.address, "123.456.789.10");
strcpy (parms.username, "pschalla");
strcpy (parms.password, "enigmal");
RISlocate_client(&parms);
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
The protocol field in client_parms structure specifies the protocol interacting with the
node where the RIS client executable resides. The protocols and their corresponding
codes are:
Protocol
Code
xns
tcp/ip
decnet
memory (local)
X
T
D
M
Use the memory protocol when the RIS client resides on the local machine.
5 - 50
RIS Functions
The address field specifies the address of the node. The protocols and their
corresponding address formats are:
Protocol
Code
xns
tcp/ip
decnet
memory (local)
name or XXXXXXXX.XX-XX-XX-XX-XX-XX
name or XXX.XXX.XXX.XXX
name or XX.XXXX
invalid
It is invalid to specify an address with the memory protocol. Use the username field
to specify a valid username on the node. It is invalid to specify a user with the
memory protocol. If the username specified requires a password, specify it in the
password field.
Use the major field in the client_parms structure to specify the major version of the
client and the feature field to specify the feature version of the client. The major
version of the client should be greater than or equal to the major version of the
application.
The major client version default and the feature client default is zero. Use these
defaults when the client version is the same as the application version.
RIS for Windows NT currently supports only the TCP/IP protocol.
RIS Functions 5 - 51
RISlocate_schema_file
RISlocate_schema_file stores the location of the RIS schema file in the parameters
file. You must specify the location of the RIS schema file on a particular node in the
parms file. You must call RISlocate_schema_file to modify the location specified in
the parms file.
void RISlocate_schema_file( schema_file_parms *parms );
Keyword/Identifier
__________________
Description
___________
parms
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If the memory protocol is specified, and address, username, or
password is also specified, then error code
RIS_E_INCONSISTENT_SCHFILE_SPEC is returned.
If other protocols (X, T, and D) are specified, but address and
username are not, the same error code is returned. If the file
name is not specified, the error code
RIS_E_MISSING_SCH_FILE_NAME is returned.
Notes
_ ____
The protocol field in schema_file_parms structure specifies the protocol interacting
with the node where the RIS schema file resides. The protocols and their
corresponding codes are:
Protocol
Code
xns
tcp/ip
decnet
memory(local)
X
T
D
M
5 - 52
RIS Functions
Protocol
Code
xns
tcp/ip
decnet
memory(local)
name or XXXXXXXX.XX-XX-XX-XX-XX-XX
name or XXX.XXX.XXX.XXX
name or XX.XXXX
INVALID
You cannot specify an address with the memory protocol. Use the
username field to specify a valid username on the node. You also
cannot specify a user with the memory protocol.
If the username specified requires a password, specify it in the password
field.
The filename field specifies the name of the RIS schema file. If the file resides on a
remote node, you must locate it in a directory that can be read and written by the
specified username. If the file resides on the local machine, you must locate it in a
directory that can be read and written by the user running RIS. If the filename does
not specify a path, then the RIS schema file is assumed to be in the directory where
RIS is installed (for CLIX), or in the shared component directory (for Windows NT).
Examples
_________
parms.protocol = M;
parms.address[0] = ;
parms.username[0] = ;
parms.password[0] = ;
strcpy(parms.filename, "/usr/bob/risschema");
RISlocate_schema_file(&parms);
parms.protocol = X;
strcpy(parms.address, "000134e3.08-00-36-e2-4f-00");
strcpy(parms.username, "bob");
strcpy(parms.password, "vandy");
strcpy(parms.filename, "risschema");
RISlocate_schema_file(&parms);
RIS Functions 5 - 53
RISrestore_schema_file_checksum
RISrestore_schema_file_checksum reads the RIS schema file, calculates the
checksum, and updates the checksum value in the RIS schema file.
You must recalculate the checksum value if you update the RIS schema file directly,
or when the RIS schema file is corrupted.
void RISrestore_schema_file_checksum( void );
Examples
_________
main()
{
RISrestore_schema_file_checksum( );
if (SQLCODE != RIS_SUCCESS)
printf("Error in the called function\n");
}
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
If RIS client process has terminated, an
RIS_E_CLIENT_DEAD error is returned.
5 - 54
RIS Functions
RISstart_client
RISstart_client starts the RIS client process specified in the client parameters of RIS
parameters file.
void RISstart_client( void );
Examples
_________
main
{
RISstart_client();
if(SQLCODE != RIS_SUCCESS)
{
printf("could not start client\n");
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
See function RISlocate_client to set previously mentioned RIS client parameters.
RIS Functions 5 - 55
RISstop_client
RISstop_client clears all prepared statements, clears all asynchronous statements,
and stops the RIS client process.
void RISstop_client( void );
Examples
_________
main
{
RISstop_client();
if(SQLCODE != RIS_SUCCESS)
{
printf("could not stop client\n");
}
}
Status Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
Notes
_ ____
If any asynchronous statements are in incomplete state, then RISstop_client fails.
5 - 56
RIS Functions
RISterminate
RISterminate terminates the RIS client process and any RIS servers it is using.
RISterminate also frees resources such as shared memory segments and semaphore
sets. Calling RISterminate is optional. RIS automatically terminates when the
application process exits.
void RISterminate( void );
Examples
_________
main()
{
RISinitialize("english");
if(SQLCODE != RIS_SUCCESS)
{
printf("Could not initialize\n");
}
RISterminate();
if(SQLCODE != RIS_SUCCESS)
{
printf("Could not terminate\n");
}
}
Status
Returns
______________
Success
Failure
SQLCODE = RIS_SUCCESS
SQLCODE = Error number
__________________________________________________________________________________________________________________________________________________
6-2
6.
__________________________________________________________________________________________________________________________________________________
6-4
Data
Type
__________
Argument
_ ________
RISfrm_init_parms
*init_parms
I/O
____
I
Description
___________
Pointer to a structure which
contains pointers to userdefined functions.
Notes
_ ____
The RISfrm_init_parms data type is defined in the risforms.h include file as follows:
typedef struct RISfrm_init_parms_s
{
/*
**
Notification routines
*/
void (*pre_notification_routine)();
void (*post_notification_routine)();
/*
**
*/
void
void
void
void
void
void
void
void
void
void
void
void
void
Initialization routines
(*alter_table_init_routine)();
(*create_schema_init_routine)();
(*create_table_init_routine)();
(*data_definition_init_routine)();
(*db2pass_init_routine)();
(*dict_access_init_routine)();
(*drop_schema_init_routine)();
(*drop_table_init_routine)();
(*exclude_init_routine)();
(*include_init_routine)();
(*locate_client_init_routine)();
(*node_info_init_routine)();
(*ris_dbs_init_routine)();
void
void
void
void
void
void
void
void
/*
**
*/
int
int
int
int
int
int
int
int
int
int
int
int
int
/*
**
*/
int
(*schema_access_init_routine)();
(*schema_definition_init_routine)();
(*schema_file_init_routine)();
(*schema_info_init_routine)();
(*schema_mgr_init_routine)();
(*schema_password_init_routine)();
(*set_init_routine)();
(*table_info_init_routine)();
Execution routines
(*alter_table_exec_routine)();
(*create_schema_exec_routine)();
(*create_table_exec_routine)();
(*db2pass_exec_routine)();
(*dict_access_exec_routine)();
(*drop_schema_exec_routine)();
(*drop_table_exec_routine)();
(*exclude_exec_routine)();
(*include_exec_routine)();
(*node_info_exec_routine)();
(*schema_access_exec_routine)();
(*schema_password_exec_routine)();
(*set_exec_routine)();
Error Handler
(*error_handler_routine)();
/*
**
Display Help Buttons
*/
char
display_help_buttons;
} RISfrm_init_parms;
These fields, except display_help_buttons, are pointers to your functions. RIS automatically
calls the functions after various events, as described in the following list. To ignore an event,
set the corresponding field to NULL. To ignore all events, set the init_parms argument to
NULL. To display Help buttons on the forms set display_help_buttons to 1, otherwise set it
to 0.
If you provide the following functions, RIS calls them immediately before or after any
user input to any of the RIS forms.
void (*pre_notification_routine)()
void (*post_notification_routine)()
6-6
double
Form
value;
fp;
*/
*/
The risforms.h include file contains the form and gadget labels. For more information
about form notification routines, see the I/Forms Programmers Guide.
If you provide the following functions, RIS calls each one immediately before its
respective form displays.
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
void
(*alter_table_init_routine)()
(*create_schema_init_routine)()
(*create_table_init_routine)()
(*data_definition_init_routine)()
(*db2pass_init_routine)()
(*dict_access_init_routine)()
(*drop_schema_init_routine)()
(*drop_table_init_routine)()
(*exclude_init_routine)()
(*include_init_routine)()
(*locate_client_init_routine)()
(*node_info_init_routine)()
(*ris_dbs_init_routine)()
(*schema_access_init_routine)()
(*schema_definition_init_routine)()
(*schema_file_init_routine)()
(*schema_info_init_routine)()
(*schema_mgr_init_routine)()
(*schema_password_init_routine)()
(*set_init_routine)()
(*table_info_init_routine)()
void include_init_routine( fp )
Form fp; /* pointer to the form */
void locate_client_init_routine( fp )
Form fp;
/* pointer to the form */
void node_info_init_routine( fp )
Form fp; /* pointer to the form */
void ris_dbs_init_routine( fp )
Form fp; /* pointer to the form */
void schema_access_init_routine( fp )
Form fp;
/* pointer to the form */
void schema_definition_init_routine( fp )
Form fp; /* pointer to the form */
void schema_file_init_routine( fp )
Form fp; /* pointer to the form */
void schema_info_init_routine( fp )
Form fp; /* pointer to the form */
void schema_mgr_init_routine( fp )
Form fp; /* pointer to the form */
void schema_password_init_routine( fp )
Form fp; /* pointer to the form */
void set_init_routine( fp )
Form fp; /* pointer to the form */
void table_info_init_routine( fp )
Form fp; /* pointer to the form */
If you provide the following functions, RIS calls each one when the user selects the
execute button on the respective form.
int
int
int
int
int
int
int
int
int
int
int
int
int
(*alter_table_exec_routine)()
(*create_schema_exec_routine)()
(*create_table_exec_routine)()
(*db2pass_exec_routine)()
(*dict_access_exec_routine)()
(*drop_schema_exec_routine)()
(*drop_table_exec_routine)()
(*exclude_exec_routine)()
(*include_exec_routine)()
(*node_info_exec_routine)()
(*schema_access_exec_routine)()
(*schema_password_exec_routine)()
(*set_exec_routine)()
6-8
These functions must return an integer value. If they return a zero (0), RIS does not
execute the RIS command string. If they return a nonzero, RIS attempts to execute the
RIS command string.
The argument str points to a static variable which contains the actual RIS command
string to execute. If you alter the contents of str, you also alter the command that RIS
attempts to execute.
If you provide this function, RIS calls it whenever a RIS error occurs.
int (*error_handler_routine)();
This function must return an integer value. If it returns a zero (0), RIS does not display
the RIS error string. If it returns a nonzero, RIS displays the RIS error string.
The argument ris_error_str points to a static variable which contains the actual RIS
error string to display. If you alter the contents of ris_error_str, you also alter the error
message that RIS displays.
Before using these routines with I/Forms, you must call the Enter_tools,
Enable_events, and FI_enter functions. You must also load the fixed VLT.
Before using these routines with I/XForms, you must call the XOpenDisplay,
FSEnter, and FI_enter functions.
6 - 10
Notes
_ ____
It is valid to pass NULL as a function address. This cancels any previously defined
functions.
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
RISfrm_alter_table_form_displayed(void)
RISfrm_create_schema_form_displayed(void)
RISfrm_create_table_form_displayed(void)
RISfrm_data_def_form_displayed(void)
RISfrm_db2pass_form_displayed(void)
RISfrm_dict_access_form_displayed(void)
RISfrm_drop_schema_form_displayed(void)
RISfrm_drop_table_form_displayed(void)
RISfrm_exclude_form_displayed(void)
RISfrm_include_form_displayed(void)
RISfrm_locate_client_form_displayed(void)
RISfrm_node_info_form_displayed(void)
RISfrm_ris_dbs_form_displayed(void)
RISfrm_schema_access_form_displayed(void)
RISfrm_schema_definition_form_displayed(void)
RISfrm_schema_file_form_displayed(void)
RISfrm_schema_info_form_displayed(void)
RISfrm_schema_mgr_form_displayed(void)
RISfrm_schpass_form_displayed(void)
RISfrm_set_form_displayed(void)
RISfrm_table_info_form_displayed(void)
Status Returns
______________
0
non-zero
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
extern
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
RISfrm_display_alter_table_form(void)
RISfrm_display_create_schema_form(void)
RISfrm_display_create_table_form(void)
RISfrm_display_data_def_form(void)
RISfrm_display_db2pass_form(void)
RISfrm_display_dict_access_form(void)
RISfrm_display_drop_schema_form(void)
RISfrm_display_drop_table_form(void)
RISfrm_display_exclude_form(void)
RISfrm_display_include_form(void)
RISfrm_display_locate_client_form(void)
RISfrm_display_node_info_form(void)
RISfrm_display_ris_dbs_form(void)
RISfrm_display_schema_access_form(void)
RISfrm_display_schema_definition_form(void)
RISfrm_display_schema_file_form(void)
RISfrm_display_schema_info_form(void)
RISfrm_display_schema_mgr_form(void)
RISfrm_display_schpass_form(void)
RISfrm_display_set_form(void)
RISfrm_display_table_info_form(void)
Status Returns
______________
RIS_SUCCESS
Other
Notes
_ ____
To execute the following functions, you must set the RIS Default Schema. These functions
require a default schema to perform RIS queries:
RISfrm_display_table_info_form
RISfrm_display_create_table_form
RISfrm_display_drop_table_form
RISfrm_display_alter_table_form
6 - 12
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
int
RISfrm_erase_alter_table_form(void)
RISfrm_erase_create_schema_form(void)
RISfrm_erase_create_table_form(void)
RISfrm_erase_data_def_form(void)
RISfrm_erase_db2pass_form(void)
RISfrm_erase_dict_access_form(void)
RISfrm_erase_drop_schema_form(void)
RISfrm_erase_drop_table_form(void)
RISfrm_erase_exclude_form(void)
RISfrm_erase_include_form(void)
RISfrm_erase_locate_client_form(void)
RISfrm_erase_node_info_form(void)
RISfrm_erase_ris_dbs_form(void)
RISfrm_erase_schema_access_form(void)
RISfrm_erase_schema_definition_form(void)
RISfrm_erase_schema_file_form(void)
RISfrm_erase_schema_info_form(void)
RISfrm_erase_schema_mgr_form(void)
RISfrm_erase_schpass_form(void)
RISfrm_erase_set_form(void)
RISfrm_erase_table_info_form(void)
Status
Returns
______________
RIS_SUCCESS
Other
Notes
_ ____
If a RIS error occurs, RIS_forms_error.error is set to RISUTL_E_RIS_ERROR. Also, the
global variables SQLCODE and risca contains information about the RIS error. The report
error statement can be executed to retrieve a message resulting from the error.
6 - 14
__________________________________________________________________________________________________________________________________________________
7-2
7.
__________________________________________________________________________________________________________________________________________________
7-4
Privileges
Number of rows loaded per table
Number of rows rejected by RIS
See the section Directions for Using risloddes and risulddes for detailed information on using
risloddes.
7-6
Name
______
Description
___________
int
nonansimode
int
preserve_blanks
1 = preserve_blanks on.
0 = preserve_blanks off.
Default is 0.
char
filemode
char [RIS_MAX_PATH_SIZE]
mainfile
char [RIS_MAX_PATH_SIZE]
badfile
char [RIS_MAX_PATH_SIZE]
logfile
char
delimiter
int
commit_interval
int
dbs_count
struct risloddbs
*dbs
int
schema_count
struct rislodsch
*schemas
The following table lists the output fields of the risloddes structure:
Data
Type
__________
Name
______
Description
___________
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7-8
Name
______
Description
___________
char
[RIS_MAX_KEYWORD_SIZE]
dbsname
Name
______
Description
___________
char [RIS_MAX_ID_SIZE]
schname
char [RIS_MAX_ID_SIZE]
schpass
char [RIS_MAX_ID_SIZE]
osname
char [RIS_MAX_ID_SIZE]
ospass
char [RIS_MAX_ID_SIZE]
username
Database username.
Required if using the default
schema statement in an
unload file to access a secure
schema. Otherwise, this field
is ignored.
char [RIS_MAX_ID_SIZE]
userpass
char [RIS_MAX_ID_SIZE]
new_schname
char [RIS_MAX_ID_SIZE]
new_schpass
Destination schema
password.
char [RIS_MAX_ID_SIZE]
new_user
char [RIS_MAX_ID_SIZE]
new_userpass
char
select_mode
Name
______
Description
___________
char
select_mode
int
ignore_create_error
7 - 10
int
with_data
int
clear_exist_data
int
table_count
struct rislodtab
*tables
Pointer to an array of
rislodtab structures. There is
one structure for each table.
See rislodtab Structure for
more information.
Name
______
Description
___________
char
select_mode
int
view_count
struct rislodview
*views
Pointer to an array of
rislodview structures. There
is one structure for each view.
See rislodview Structure for
more information.
Name
______
Description
___________
char
select_mode
int
indxtab_count
struct rislodindx
*indxtabs
Name
______
Description
___________
char
select_mode
int
granttab_count
struct rislodgrant
*granttabs
Pointer to an array of
rislodgrant structures. There
is one structure for each
relation (table or view). See
rislodindx Structure for more
information.
7 - 12
The following table lists the output fields of the rislodsch structure:
Data
Type
__________
Name
______
Description
___________
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
rislodtab Structure
Access the rislodtab structure through a pointer in rislodsch. There is one rislodtab
structure for each table loaded. The following table lists the fields of this structure.
The tabname field is an input and output field. The remaining fields are output
fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
tabname
Table name.
int
rows_loaded
int
err_rows
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7 - 14
rislodview Structure
Access the rislodview structure through a pointer in rislodsch. There is one
rislodview structure for each view loaded. The following table lists the fields of this
structure. The viewname field is an input and output field. The remaining fields are
output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
viewname
View name.
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
rislodindx Structure
Access the rislodindx structure through a pointer in rislodsch. There is one
rislodindx structure for each table or view with indexes loaded. The tabname field is
an input and output field. The remaining fields are output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
tabname
Table name.
int
indexes_loaded
int
err_indexes
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7 - 16
rislodgrant Structure
Access the rislodgrant structure through a pointer in rislodsch. There is one
rislodgrant structure for each table or view with privileges loaded. The table_owner
and tabname fields are input and output fields. The remaining fields are output
fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
table_owner
char[RIS_MAX_ID_SIZE]
tabname
Table name.
int
grants_loaded
int
err_grants
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7 - 18
The following table lists the input fields of the risulddes structure:
Data
Type
__________
Name
______
Description
___________
char
filemode
int
preserve_blanks
1 = preserve_blanks on.
0 = preserve_blanks off.
Default is 0.
char [RIS_MAX_PATH_SIZE]
mainfile
int
schema_count
struct risuldsch
*schemas
The following table lists the output fields of the risulddes structure:
Data
Type
__________
Name
______
Description
___________
long
uld_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
The following table lists the input fields of the risuldsch structure:
Type
_Data
_________
Name
______
Description
___________
char [RIS_MAX_ID_SIZE]
schname
char [RIS_MAX_ID_SIZE]
schpass
Schema password.
char [RIS_MAX_ID_SIZE]
osname
char [RIS_MAX_ID_SIZE]
ospass
char [RIS_MAX_ID_SIZE]
dbname
char [RIS_MAX_ID_SIZE]
dbpass
char
select_mode
7 - 20
Name
______
Description
___________
char
select_mode
int
with_data
int
separate_dfile
int
variable_data_format
int
table_count
struct risuldtab
*tables
Name
______
Description
___________
char
select_mode
int
view_count
struct risuldview
*views
Pointer to an array of
risuldview structures. There is
one structure for each view.
See risuldview Structure for
more information.
Name
______
Description
___________
char
select_mode
int
indxtab_count
struct risuldindx
*indxtabs
7 - 22
Name
______
Description
___________
char
select_mode
int
granttab_count.
struct risuldgrant
*granttabs
Pointer to an array of
risuldgrant structures. There
is one structure for each
relation (table or view). See
risuldgrant Structure for more
information.
The following table lists the output fields of the risuldsch structure:
Data
Type
__________
Name
______
Description
___________
long
uld_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
risuldtab Structure
Access the risuldtab structure through a pointer in risuldsch. There is one risuldtab
structure for each table unloaded. The following table lists the fields of this
structure. The tabname field is an input and output field. The remaining fields are
output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
tabname
Table name.
char
*whereclause
char[RIS_MAX_ID_SIZE]
data_filename
int
rows_unloaded
int
err_rows
long
lod_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7 - 24
risuldview Structure
Access the risuldview structure through a pointer in risuldsch. There is one
risuldview structure for each view unloaded. The following table lists the fields of
this structure. The viewname field is an input and output field. The remaining fields
are output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
viewname
View name.
long
uld_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
risuldindx Structure
Access the risuldindx structure through a pointer in risuldsch. There is one
risuldindx structure for each table or view with indexes unloaded. The tabname field
is an input and output field. The remaining fields are output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
tabname
Table name.
int
indexes_loaded
int
err_indexes
long
uld_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
7 - 26
risuldgrant Structure
Access the risuldgrant structure through a pointer in risuldsch. One risuldgrant
structure is allocated for each table or view with privileges unloaded. The
table_owner and tabname fields are input and output fields. The remaining fields are
output fields only.
Data
Type
__________
Name
______
Description
___________
char[RIS_MAX_ID_SIZE]
table_owner
char[RIS_MAX_ID_SIZE]
tabname
Table name.
int
grants_unloaded
int
err_grants
long
uld_err_code
long
ris_err_code
long
db_err_code
char
sqlwarnings[8]
1.
Define a structure of type risloddes. The following are default values for this structure:
Field Name
___________
Default Value
_____________
delimiter
commit_interval
nonansimode
filemode
mainfile
badfile
logfile
single quotation ()
25
ansi mode on (0)
e
ris.dmp
ris.bad
ris.log
2.
3.
4.
Set the schema_count field to a positive value indicating number of schemas to load.
5.
6.
Assign schema information, that is, set the appropriate fields of each rislodsch
structure.
a.
Set schema select_mode to a (all objects of the schema) or s (some of the objects
of the schema). There is no default.
b.
If you set select_mode to a, then ignore all the other fields of the rislodsch
structure. Also ignore rislodtab, rislodview, rislodindx, and rislodgrant structures.
Appropriate structure members returning status are set by the loader. All
*info.select_mode fields are set to a by the loader. The following are default
values for the rislodtab structure (when schemas select_mode is set to a):
Field Name
___________
with_data
ignore_create_error
clear_exist_data
Default Value
_____________
1
1
1
7 - 28
c.
d.
7.
Call the following function to load RIS objects indicated by the risloddes structure:
risloddes my_lod;
RIS_loader(&my_lod);
8.
Call the following function to print the status of the risloddes structure (optional):
RISlod_print_risloddes(&my_lod);
OR
RISlod_fprint_risloddes(stdout, &my_lod);
9.
1.
Define a structure of type risulddes. The following are default values for this structure:
Field Name
___________
Default Value
_____________
filemode
mainfile
e
ris.dmp
2.
3.
4.
Set the schema_count field to a positive value indicating number of schemas to unload.
5.
6.
Assign schema information, that is, set the appropriate fields of the risulddes fields.
a.
b.
If you set select_mode to a, then ignore all the other fields of risuldsch structures.
Appropriate structure members returning schemas are set by the unloader. All
the *info.select_mode fields are set to a by the unloader. The following are default
values for fields in the risuldtab structure (when schemas select_mode is set to a):
Field Name
___________
with_data
separate_dfile
variable_data_format
c.
Default Value
_____________
1
0
0
d.
7 - 30
7.
Call the following function to print RIS objects indicated by the risulddes structure:
risuldes my_uld;
RIS_unloader(&my_uld);
8.
Call the following function to print RIS objects indicated by the risulddes structure
(optional):
RISuld_print_risulddes(&my_uld);
OR
RISuld_fprint_risulddes(stdout, &my_uld);
9.
RIS_loader
This function uses the risloddes structure to interface with the rislod utility. You
assign specific load information for rislod using fields of the risloddes structure. The
rislod utility then assigns specific output to fields of the risloddes structure during
function execution.
#include "rislduld.h"
int RIS_loader (risloddes *risloddes_ptr);
Keyword/Identifier
__________________
Description
___________
risloddes_ptr
Status Returns
______________
Success
Failure
0
-1
7 - 32
RIS_unloader
This function uses the risulddes structure to interface with the risunlod utility. You
assign specific unload information for risunlod using fields of the risulddes structure.
The risunlod utility then assigns specific output to fields of the risulddes structure
during function execution.
#include "rislduld.h"
int RIS_unloader (risulddes *risulddes_ptr);
Keyword/Identifier
__________________
Description
___________
risulddes_ptr
Status Returns
______________
Success
Failure
0
-1
RISlod_fprint_risloddes
This function prints the fields of the risloddes structure to a user-specified file.
#include rislduld.h
void RISlod_fprint_risloddes (FILE *fp, risloddes *risloddes_ptr);
Keyword/Identifier
__________________
Description
___________
fp
risloddes_ptr
Notes
_ ____
If you are working in the Windows NT environment and you are not using the
riscpp.exe preprocessor to compile your source code, you must use the </>MD switch
in your compile statement.
Because the function call
RISlod_fprint_risloddes (stdout, *risloddes_ptr)
creates less overhead and produces the same result as the call
RISlod_print_risloddes (*risloddes_ptr),
use the RISlod_fprint_risloddes function when printing the risloddes structure fields.
RISlod_print_risloddes
This function prints the fields of the risloddes structure to standard output.
#include rislduld.h
void RISlod_print_risloddes (risloddes *risloddes_ptr);
Keyword/Identifier
__________________
Description
___________
risloddes_ptr
Notes
_ ____
Calling RISlod_print_risloddes is the same as calling RISlod_fprint_risloddes with
the file pointer set to stdout. Because RISlod_fprint_risloddes creates less overhead,
use RISlod_fprint_risloddes when printing the risloddes structure fields. See the
RISlod_fprint_risloddes function description for further information.
RISuld_fprint_risulddes
This function prints the fields of the risulddes structure to a user-defined file.
#include "rislduld.h"
void RIS_fprint_risulddes (FILE *fp, risulddes *risulddes_ptr);
Keyword/Identifier
__________________
Description
___________
fp
risulddes_ptr
Notes
_ ____
If you are working in the Windows NT environment and you are not using the
riscpp.exe preprocessor to compile your source code, you must use the </>MD switch
in your compile statement.
Because the function call
RIS_fprint_risulddes (stdout, *risulddes_ptr)
creates less overhead and produces the same result as the call
RIS_print_risulddes (*risulddes_ptr),
7 - 34
RISuld_print_risulddes
This function prints the fields of the risulddes structure to standard output.
#include "rislduld.h"
void RISuld_print_risulddes (risulddes *risulddes_ptr);
Keyword/Identifier
__________________
Description
___________
risulddes_ptr
Notes
_ ____
Calling RISuld_print_risulddes is the same as calling RISuld_fprint_risulddes with
the file pointer set to stdout. Because RISuld_fprint_risulddes creates less overhead,
use RISuld_fprint_risulddes when printing the risulddes structure fields. See the
RISuld_fprint_risulddes function description for further information.
Appendix A
__________________________________________________________________________________________________________________________________________________
A-2
Appendix A
__________________________________________________________________________________________________________________________________________________
A-4
A-6
A-8
A.9 RIS_BLOB/RIS_TEXT
RIS Version 5 allows long binary or long text data that lets you:
Use it for document or picture storage by INFORMIX OnLine and ORACLE. RIS has no
RIS_BLOB/RIS_TEXT support for INFORMIX Standard Engine, SYBASE, Microsoft
SQL Server, or DB2.
Insert, update, or retrieve large data.
Access character strings with a length greater than 249 characters for other RDBMSs
not supporting RIS_BLOB.
Considerations when using this capability:
To use RIS_BLOB/RIS_TEXT data, the client and data server versions must be at least
05.01.01.xx.
This feature is available only through the programming interface; no interactive access
is available.
The application should track the data length.
The RIS_BLOB data type is for binary data; for example, GIF files, executables, and so
forth. RIS makes no attempt to convert or interpret the data.
The RIS_TEXT data type is for text data; for example, ASCII files. RIS does convert
the text data between different hardware platforms as it would for char data.
The text data can be inserted into a RIS_BLOB column, but no blob data should be
inserted into a RIS_TEXT column.
To create a table with a column of RIS_BLOB/RIS_TEXT data type
create table emp (name char(25), id int, picture ris_blob (50000))
The default size of the RIS_BLOB/RIS_TEXT column is 0. The maximum length of the
data is dependent on the database. If the maximum data size is set to 0, data can be
retrieved from the database to a memory array and not a file.
The file_used field is required for inserting and retrieving. RIS uses the filename or the
memory array as the targeted user variable.
The text data and character data are converted for different hardware platforms.
The maximum size limit cannot be zero when retrieving data from the database. The
maximum size limit is zero when retrieving data from memory.
RIS_BLOB/RIS_TEXT columns cannot be used in the SQL WHERE clause or GROUP
BY statements, and cannot be indexed.
A - 10
null
Yes
In the above example, RC01 is the dictionary owner as shown in the schema file, blob_table
is the name of the table with a blob column, set to values other than 10000.
RIS limits the data size inserted into a RIS_BLOB/RIS_TEXT column if a size is specified
when the table is created.
For example:
create table blob1 (c1 ris_blob(100000))
would impose a limit of 100,000 bytes. If the table is created without specifying a size, then
the underlying RDBMSs maximum limit for RIS_BLOB/RIS_TEXT data will be used.
For example:
create table blob2 (c2 ris_blob)
A.10 Interoperability
RIS Version 5 lets multiple versions of RIS products be available on most systems. The
following figure details interoperability of RIS Version 4 and RIS Version 5.
This capability:
Lets you continue to use RIS Version 4 applications with minimal impact. Version 4
applications should continue to run.
Considerations when using this capability:
RIS Client and Data Servers should be upgraded to RIS Version 5.
Multiple versions are available remotely through TCP only.
The ORACLE 7 Data Server requires the RIS Version 5 Client.
The Sybase SQL Data Server requires the Version 5.02 Client.
Only RIS Version 5 applications can query RIS Version 5 dictionary objects. Only RIS
Version 4 applications can query RIS Version 4 dictionary objects.
The RIS utilities are also applications and the previous restrictions apply.
The risdtype utility of RIS Version 4 cannot be used with the RIS Client Version 5 or
the RIS Data Server Version 5.
Files generated by the RIS Version 4 risrecrd utility cannot be processed by the RIS
Version 5 risplbck utility. If an application is built with RIS Version 4, the resulting
record file can be processed only by the RIS Version 4 risplbck utility.
A - 12
A.12 Utilities
The RIS Version 4 ad hoc utility ris has been renamed risbatch. There is now an ad hoc
query utility with a graphic user interface (GUI), called risgui.
Considerations when using the Version 5 loader/unloader:
The loader/unloader provides no BLOB support.
The unloader unloads (or saves) RIS names (aliases) only, not the underlying object
names.
The unloader unloads (or saves) schema ownership only, not underlying RDBMS
ownership.
A.13 Parameters
The parameter file generated by a Version 5 application or utility is compatible with Version
4 applications. In Version 4, if a parameter file existed, all parameters were expected to be
set. Unlike Version 4, Version 5 is more tolerant with respect to parameter files: any number
of parameters can be left unspecified and RIS uses the default values.
A new parameter, CLIENT_VERSION, has been added with the default value set to 0.0,
meaning that the application connects to a compatible client. When future versions of RIS
become available, Version 5 and higher applications will be able to use this parameter to
specify the client version.
Using this parameter causes Version 4 applications to fail; hence, for now, leave it
commented out. When the CLIENT_VERSION parameter is set, Version 4
applications can no longer use that parameter file.
A.14 Internationalization
RIS for 32-bit applications (Version 5.3.1 and later) support 16-bit or multi-byte languages.
Most 16-bit languages are Asian. In the RIS documentation, the maximum size allowed for
table names, view names, index names, schema names, column widths, and character data is
specified as x characters, where x is an integer. For those using multi-byte languages, the
maximum number of characters should be interpreted as the maximum size in bytes.
RISMGR and RISGUI implement multi-byte character support.
RIS limitations and guidelines:
RIS schema and user names can be internationalized, but not passwords.
Only alpha-numeric characters can be internationalized.
Setup is not fully internationalized.
RIS does not localize dialogs, gadgets and error messages.
RIS is internationalized on NT only. The RIS application, RIS Client, and RIS Data
Server must be on NT to take advantage of the RIS internationalization.
The period (.) used between username and passwords must be 8-bit English.
All punctuation, keywords, column datatype definitions, timestamp data, statements
must be 8-bit English.
Schemas, tables, views, columns, index names can be 8-bit or 16-bit characters.
RIS data dictionary tables and views are created using 8-bit English characters.
The following components of a create schema statement are 8-bit and 16-bit characters:
create schema
schema name
schema pass
db type
dbname
db dir
osuser
ospass
ostype
db user
remote clause
8-bit English
8-bit and 16-bit English
8-bit English
8-bit English
8-bit and 16-bit English
8-bit and 16-bit English
16-bit English
8-bit English
8-bit English
8-bit and 16-bit English
8-bit English
A - 14
Character columns are analyzed to make sure that they are wide enough to hold the data.
For example, a 10 character name in a 16-bit language requires a char(20) column.
The maximum number of 8-bit characters in a column is 240. The maximum number of 16bit characters in a column is 120.
Appendix B
__________________________________________________________________________________________________________________________________________________
B-2
Appendix B
__________________________________________________________________________________________________________________________________________________
Declaring Tables/Views
When an application first uses a table or view in an SQL statement, some initial overhead is
generated. RIS must learn the names, data types, and sizes of the columns (and if they are
nullable). This information is used to verify that the statement is correct and is used with
appropriate variables. RIS has to query the database to get this information. This is
overhead. If the application does not know anything about the table or view, this overhead
cannot be avoided. If, however, the application knows the definition of the table, the declare
table or declare view statements can be used to provide the information to RIS and avoid the
overhead.
The sample program risdeclare is delivered with RISDP. This program easily generates
table and view declarations for objects in schemas.
Use table declarations in any application that has a standard set of tables because these
tables are generally used only once, either at the start of an application or just before a
table/view is used for the first time. If your application uses a variety of user-defined or
modified tables, consider implementing a mechanism for reading in table/view definitions
that might be used. For example, keep the list of tables/views that have been used in SQL
statements. Then, before using a table, check the list to see if it has been declared.
Compatibility between the declaration and the actual table is important. A declaration with
no compatibility verification is the fastest because it completely bypasses the database. A
declaration with partial verification requires some database interaction, but is still fairly
quick. A full verification declaration should be used primarily to verify that the list of
declarations is up to date and identical to what is in the database system.
Table definitions are cached by RIS. The number of table definitions cached is determined by
the MAX_TABLES_IN_MEM value in the parameter file. When this value overflows, table
definitions are removed. MAX_TABLES_IN_MEM should be larger than the number of
tables the application uses. Caching table definitions creates a memory versus performance
trade-off.
B.2
Error Handling
RIS returns a status code for each statement executed. Always check the status of each
statement. Failure to check the status may result in unexpected failure of other statements.
The global integer variable SQLCODE contains the status. The value RIS_SUCCESS
indicates success, END_OF_DATA indicates end-of-data, and negative values indicate an
error.
B-4
Use the risca and dbca variables to get additional error information. The risca variable is a
pointer to an rissqlca error structure containing detailed RIS error information. The dbca
variable is a pointer to an rissqlca error structure containing error information from the
underlying DBMS. Both structures are defined in ris.h.
Also use the report error and whenever statements for error handling. The report error
statement obtains a string containing the RIS and underlying DBMS error messages. The
whenever statement defines handlers for error and end-of-data conditions.
B.3
RIS automatically initializes when the first RIS statement is executed. The initialization
process reads information from the parms file, allocates semaphores and shared memory,
sets up internal structures, and then starts the RIS client process.
RIS also automatically terminates when the application process terminates. The RIS client
checks for the existence of the application process at fixed time intervals. When the RIS
client process detects that the application process is no longer running, it shuts down all of
its RIS servers, frees up resources such as semaphores and shared memory, and then
terminates.
It is possible to explicitly initialize and terminate RIS. You can initialize RIS by calling the
RISinitialize function. Calling this function prevents delay of the first RIS statement while
RIS initializes. To avoid delay of the first statement, call RISinitialize during the application
initialization phase. You can terminate RIS by calling the RISterminate function. RIS
normally terminates briefly after application termination. To avoid delay in RIS termination
or to terminate RIS without terminating the application, call RISterminate. Use of these
functions is highly recommended.
B.4
Locking
Locking is either explicit or implicit. The DBMS implicitly locks, but explicit locking requires
the lock tables statement.
Implicit locking can be problematic because each DBMS does it differently. Databases differ
in both the scope and type of locking. A DBMS can lock at the row, page, or table level. You
can modify the locking behavior of some, but not all, databases. Also, a DBMS may
originally lock at the row or page level and escalate the locks to table level if necessary. This
is because the total number of row and page locks is limited. This limit also varies depending
on the DBMS.
The two basic lock types are share and exclusive. Use a share lock when reading data. This
prevents other users from updating the data being read. Multiple users can have a share
lock on the same data. Exclusive locks prevent users from accessing the data in any way.
Use exclusive locks when modifying data to prevent others from modifying or viewing the
data. Every DBMS has a share and an exclusive lock, but the locks behavior varies among
different databases. The DBMS may also have additional lock types.
Explicit locking ensures that locking is performed uniformly across different DBMSs.
However, explicit locking has restrictions. First, you can only lock data at the table level
using the lock tables statement. Page and row level locking are implicit only. Next, you
must make the lock tables statement the first statement within a transaction. Finally, you
must specify all tables used in the transaction when the lock tables statement is used.
The lock tables statement allows simultaneous locking of multiple tables in different modes.
Each table can be locked in either share, exclusive, or default mode. The share and exclusive
modes correspond to the types of locks previously described. Default mode informs the
DBMS to use implicit locking. The explicit and implicit locks are held until the transaction is
committed or rolled back.
B.5
Managing Statements
B.6
Order By Statement
Ordered results are sometimes useful but always expensive. Database systems do not
always sort efficiently and may need extensive tuning to avoid using temporary tables. For
small result sets, your application may be better able to sort items more quickly.
In general, be sure the application does not automatically use an order by clause in queries
when it is not needed.
B.7
Preparing Statements
In situations where SQL statements are executed repetitively, you can increase performance
by (1) executing the statement statically, or (2) splitting the dynamic execution into two
phases, prepare and execute. Preparing consists of syntactic checking and structure
initialization. You increase performance by preparing the statement once instead of multiple
times. When you use execute immediate, RIS prepares and executes the statement for each
use.
With static statements such as insert, update, delete, and select into, RIS automatically keeps
the most recently used static statements prepared. The exact number of static statements
RIS keeps prepared is dependent on the MAX_STATIC_STMTS parameter in the parameters
file.
For more information about configuring the MAX_STATIC_STMTS parameter, see the RIS
SQL Users Guide for 32-Bit Applications.
When using the same dynamic C SQL statement repetitively, you do not have to prepare the
statement for each use. Prepare the statement once, then execute it multiple times.
Remember that the schema used to prepare the statement must be the same schema used to
B-6
Example
2
__________
query = "insert into table1 values(1)";
exec sql prepare stmt1 from :query;
for ( i=0; i<20; i++)
{
exec sql execute stmt1;
}
B.8
When choosing between remote RIS connections (using RIS network functionality) and
RISNET connections (using DBMS vendor network connections), RIS connections are
generally faster. Vendor network connections have to be much more generic and are not as
efficient.
B.9
Schema Files
Information about schemas and databases is available by querying the ris5schemas and
ris5dbs data dictionary tables. The same information is available much more quickly by
using functions. For example, the RISget_schema_file() function retrieves all database and
schema information in the schema file.
B.12 Transactions
Transactions allow a series of SQL statements to be grouped logically and ensures that all
database modifications are entirely committed or rolled back. A commit or rollback frees all
locks and closes all open cursors. Data definition statements such as create, drop, and alter
are always automatically committed. By default, data manipulation statements such as
select, insert, update, and delete are also automatically committed. Use the set transaction
statement to turn autocommit off. This ensures that data manipulation statements are not
automatically committed. You must then use the commit and rollback statements to
terminate a transaction. Any transaction in progress when the program terminates is rolled
back.
The autocommit mode makes it difficult to have more than one cursor open at a time. This is
because the commit for a select statement in autocommit mode is performed when the cursor
is closed.
Since a commit closes all open cursors, all other open cursors are also closed. To avoid this
problem, turn autocommit mode off.
Turning autocommit mode off also improves performance by eliminating the overhead of
committing after every statement. However, keep transactions as small as possible to avoid
blocking other users from accessing tables locked during the transaction.
B-8
To get the next unique record number, use the following general procedure:
Select the most recent value from the table.
select last_id into :old_id from table;
If the update succeeds, then the selected value +1 is the next number. If the update fails,
then someone else selected the same value and has already updated the table. This indicates
that your number is out of date. Do not select again. Simply increment your variable and
try the update again.
For example, the next unique record number for the states table can be obtained as follows:
int tries = 0;
exec sql begin declare section;
int my_value;
int old_value;
exec sql end declare section;
/*
** Catch and handle all severe errors in the same way.
*/
exec sql whenever sqlerror goto :error;
/*
** Catch a not-found condition for just the initial query.
*/
exec sql whenever not found goto :not_found;
select last_id into :old_value where table_name = states;
/*
** Catch a not-found condition for the update statement.
*/
To get the next unique record number for the states table, use the following code segment:
int tries = 0;
exec sql begin declare section;
int my_value;
int old_value;
exec sql end declare section;
/*
** Catch and handle all severe errors in the same way.
*/
exec sql whenever sqlerror goto :error;
/*
** Catch a not-found condition for just the initial query.
*/
exec sql whenever not found goto :not_found;
select last_id into :old_value where table_name = states;
/*
** Catch a not-found condition for the update statement.
*/
exec sql whenever not found goto :increment_and_retry;
try_again:
if (tries > 50)
{
/*
** Something is probably wrong.
** Place a limit on loop.
*/
return;
}
my_value = old_value + 1;
++tries;
/*
** Try to update the old value based on the old value.
*/
exec sql update last_id set last_id = :my_value
where last_id = :old_value;
/*
** If successful, commit and return; otherwise, it will have jumped.
*/
exec sql commit;
return;
/*
** Try the next value.
*/
B - 10
increment_and_retry:
++old_value;
goto try_again;
not_found:
/*
** Internal error:
*/
error:
/*
** Error handling.
*/
sufficiently specific. The best way to improve performance is to make the query more
specific.
Even in this situation, a case can sometimes (though rarely) be made for an index. If you
know that 99% of the values are M and that your application is only interested in the F
values, an index would probably help.
To get an idea of the uniqueness of the values in column_x, try:
select (count(distinct column_x)/count(*))*100 from table_x;
100% is perfect. Even 50% is good. When the count starts dropping into the 10-20% range,
an index becomes less and less useful. When a concatenated index (two or more columns)
exists, the second column is not indexed. For example, if the concatenated index phone_idx is
created on (area_code, phone_number), then the query
select * from phones where phone_number = 123-4567;
does not use the index. A concatenated index cannot be used for a query unless the first
column of the index is in the where clause.
Therefore,
select * from phones where area_code = 205;
is ineffective because the phone_idx is used, but the uniqueness of area_code is low. The
index just adds overhead to the query.
The query
select * from phones where phone_number = 123-4567;
B - 12
When joining two tables, create indexes on the join columns. If your analysis indicates
that an index will not help, reconsider your design and ask why a join is being done
with those columns.
No index is useful without a where clause. Make your statements as specific as
possible.
are very inefficient. Query optimizers are not overly intelligent. They do not generally look
at the query values and realize that they could be condensed into something like
where c1 between 101 and 300;
OR
c1 > 100 and < 301 and c1 <> 207 and c1 <> 155;
Long statements require a lot of parsing. After that, too many OR clauses make an
optimizer decide that an index does not help.
The simpler your query, the better the chance of a fast response.
Appendix C
__________________________________________________________________________________________________________________________________________________
C-2
Appendix C
__________________________________________________________________________________________________________________________________________________
You can also add new languages currently not supported by RIS as long as they are
supported by the operating system and database.
Defining RIS Language Settings for NT:
1.
2.
Scroll through the list of languages available under the Language drop-down list.
3.
4.
Click OK. The system prompts you for the source of the operating system language
files.
5.
The following is the langs file currently supported by RIS. The format of this file is specified
by six (6) fields per line separated by a pipe (|) delimiter. Each line represents one language
mapping between RIS and the underlying operating system. The format is:
ris_lang_id|ris_lang_name|ris_lang_dir|os_lang_id|code_page|os_lang_name
ris_lang_id
ris_lang_name
ris_lang_dir
os_lang_id
code_page
C-4
os_lang_name
Below is a sample language configuration file. Only languages with the same code page can
interoperate. If the two languages do not have the same code page then RIS gives an error of
RIS_E_INCOMPATIBLE_LANGS.
Sample langs file:
0 |english
|english
|0x0409|1252|U.S. English
1 |korean
|korean
|0x0412|946|korean
2 |chinese
|chinese
|0x0404|950|Traditional Chinese
3 |japanese
|japanese
|0x0411|932|Japanese
4 |german
|german
|0x0407|1252|German
5 |french
|french
|0x040C|1252|French
6 |spanish
|spanish
|0x0C0A|1252|Modern Spanish
7 |italian
|italian
|0x0410|1252|Italian
8 |arabic
|arabic
|0x0401|1256|Arabic
9 |bulgarian
|bulgaria
|0x0402|1251|Bulgarian
10|catalan
|catalan
|0x0403|1252|catalan
11|traditional chinese |chinese.smp |0x0804|936|Simplified Chinese
12|czech
|czech
|0x0405|1250|Czech
13|danish
|danish
|0x0406|1252|Danish
14|swiss german
|german.sws |0x0807|1252|Swiss German
15|uk english
|english.uk |0x0809|1252|U.K. English
16|australian english |english.aus |0x0C09|1252|Australian English
17|canadian english
|english.can |0x1009|1252|Canadian English
18|mexican spanish
|spanish.mex |0x080A|1252|Mexican Spanish
19|finnish
|finnish
|0x040B|1252|Finnish
20|belgian french
|french.blg |0x080C|1252|Belgian French
21|canadian french
|french.can |0x0C0C|1252|Canadian French
22|swiss french
|french.sws |0x100C|1252|Swiss French
23|hebrew
|hebrew
|0x040D|1255|Hebrew
24|hungarian
|hungarian
|0x040E|1250|Hungarian
25|icelandic
|icelandic
|0x040F|1252|Icelandic
26|swiss italian
|italian.sws |0x0810|1252|Swiss Italian
27|dutch
|dutch
|0x0413|1252|Dutch
28|belgian dutch
|dutch.blg
|0x0813|1252|Belgian Dutch
29|norwegian bokmal
|norwegia.bkm|0x0414|1252|Norwegian-Bokmal
30|norwegian nynorsk
|norwegia.nyn|0x0814|1252|Norwegian-Nynorsk
31|polish
|polish
|0x0415|1250|polish
32|brazilian portuguese|portugue.brz|0x0416|1252|Brazilian Portuguese
33|portuguese
|portugue
|0x0816|1252|Portuguese
34|rhaeto romanic
|rhaeto.rom |0x0417|0|Rhaeto-Romanic
35|romanian
|romanian
|0x0418|1250|Romanian
36|russian
|russian
|0x0419|1251|Russian
37|croata serbian
|croata
|0x041A|1250|Croato-Serbian
38|serbo croatian
|serbo
|0x081A|1250|Serbo-Croatian
39|slovak
|slovak
|0x041B|1250|Slovak
40|albanian
|albanian
|0x041C|1250|Albanian
41|swedish
|swedish
|0x041D|1252|Swedish
42|thai
|thai
|0x041E|874|Thai
43|turkish
|turkish
|0x041F|1254|Turkish
44|urdu
|urdu
|0x0420|0|Urdu
45|bahasa
|bahasa
|0x0421|1252|Bahasa
Appendix D
__________________________________________________________________________________________________________________________________________________
D-2
Appendix D
__________________________________________________________________________________________________________________________________________________
ReadInfFile();
Call this function once before calling any other setup functions for the RIS Shared
Component.
D-4
b.
SetupRIS();
This function determines the version of the RIS Shared Component that is already
installed, if any. You must use the value returned by this function as input to the
RegEdtRIS function.
Status
Returns
______________
0
1
2
c.
CopyFilesInCopyList();
This function downloads your application files and the RIS Shared Component
files (if necessary).
d.
Description
___________
action
listEntry
risrem.lib The functions in this library remove the RIS Shared Component from the
system. Link your application remove program with this library. To remove the RIS
Shared Component in case of an error, link your setup program with this library.
a.
Description
___________
remInstance
listEntry
This function removes your applications entry from the RefList field in the RIS
Shared Component registry key.
Status
Returns
______________
0
1
b.
This function removes the RIS Shared Component services, files, and registry
entries.
Keyword/Identifier
__________________
Description
___________
remInstance
flag
readme1.txt This uncompressed README file contains the RIS product name and
version.
The primary purpose of this file is to keep track of the RIS Shared Component version,
but you can add information from the RIS README file if it would be useful to the
end-user.
manifes1.txt This uncompressed ASCII file lists the files that are delivered with the
RIS Shared Component. You must integrate this file into the manifest file for your
application.
Installs the required files on the users file system (after first checking to make sure
that the version being installed is the same or newer than any existing version) and if
an older version is found, it is removed.
2.
3.
Installs the RIS TCP service, and starts it. This service lets remote applications and/or
clients connect to other servers on the system.
4.
Creates a RIS program group, which contains various help and executable utilities.
The installation procedure examines the system PATH variable to see if it contains the
\Program Files\Common Files\Intergraph directory. If the PATH does not contain this
directory, the installation procedure appends \Program Files\Common Files\Intergraph to
the system PATH.
D-6
Registry Information
The RIS Shared Component puts information into the System Registry to indicate its
presence on the system. The component installation procedure creates the key
HKEY_LOCAL_MACHINE\Software\Intergraph\RIS\<Major.Minor>
SoftwareType
IDNumber
RelDate
Version
RefList
The RefList entry facilitates removal of the shared component. All products that use the RIS
Shared Component must add themselves to this reference list (with the RegEdtRIS function)
during installation, and must remove themselves from the list (with the RemoveRIS function)
during removal.
Any product that wants to remove a shared component can do so only if the reference list for
the shared component is empty. The RefList consists of a semicolon-separated list of
products that use the shared component. The referencing product string has the format
<product_name>\<product_version> where this information is the same as the name\version
portion of the registry key for the product.
Glossary GL - 1
Glossary
__________________________________________________________________________________________________________________________________________________
GL - 2
Glossary
Glossary GL - 3
Glossary
__________________________________________________________________________________________________________________________________________________
accept
access
activate
ad hoc query
address
alias
ANSI
api
application
array
ASCII
association
associative
attribute
bar menu
Strip at the top of the screen that contains icons for selecting
commands.
bit mask
GL - 4
Glossary
buffer
Data area.
byte
cache
catalog
character
client
collapse
command
command file
command line
command name
Glossary GL - 5
command string
communication
protocol
compile
configuration file
constant
CPU
cursor statement
Data Definition
Language
data dictionary
Data Manipulation
Language
data point
data structure
data type
database
database
administrator
database privilege
DB2
GL - 6
Glossary
DBA
DDL
debug
DEC
declaration
default schema
delimiter
design file
development platform
device
directory system
disk
DML
double precision
drawing file
drop
dynamic SQL
statement
Glossary GL - 7
entity
environment variable
error handler
error message
Ethernet
exception
exception handler
executable
exit
field
file
filename
flag
float
floating point
notation
floppy disk
GL - 8
Glossary
font
form
form label
function
global variable
grant option
graphic
group
home directory
host variable
icon
ID
identify
IGE
include file
index
indicator variable
Glossary GL - 9
INFORMIX
INGRES
initialize
integer
interactive
interface
I/ORL
item
joining
key-in
keyword
LAN
library
Collection of subroutines.
linear
link
log in
GL - 10
Glossary
macro, RIS
malloc
mask
memory
menu
mode
model
network
node
noncursor statement
NULL
Indicates no value.
on-line Help
operating system
ORACLE
ORL
See I/ORL.
overview
parameter, RIS
Glossary GL - 11
password
path
place
pointing
pop-to-bottom
pop-to-top
portable
preprocessor
privilege
process
prompt
query
A search in a database.
raster
RDBMS
GL - 12
Glossary
real
record
relation
Table or view.
relation privilege
relational database
management system
Relational Interface
System
report
requester
See client.
resize
resolution
restore
RIS
root
routine
row
run
runtime
Glossary GL - 13
scale
scan
schema
select
semaphore
server
set
Shamrock
shared library
shared memory
shell
short
signal
signal handler
smallint
GL - 14
Glossary
source file
SQL
SQL terminator
sqlda structure
sqlvar structure
stack
statement
string
Sequence of characters.
Structured Query
Language
symbolic constant
syntax
system
table
table, database
TCP/IP
Glossary GL - 15
toggle
transaction
tuple
Record or a row.
type
type face
UNIX
user
user interface
value
variable
VAX/VMS
version
view
view, database
virtual declaration
virtual table
wildcard
XNS
GL - 16
Glossary
Index IN - 1
Index
__________________________________________________________________________________________________________________________________________________
IN - 2
Index
Index IN - 3
Index
__________________________________________________________________________________________________________________________________________________
A
accessing
dictionary views A-7
aliases
exclude/include sequences A-4
object A-4
within RIS A-4
alter statement B-7
alter table form 6-3
American national standards institute 2-3
ANSI 2-3
api library 2-6
ascii strings 5-8
async statement 4-7
asynchronous execution
statements 2-24
autocommit mode B-7
B
before you begin 1-3
begin declare statement 4-8
binary data A-8
binary data type 3-3
binding
host variables 2-12
bit masks 5-27
blob data type 3-3
BLOBS
programming interface A-8
buffer pointer 5-39
C
caution symbol 1-5
char[ ] data type 4-8
char* data type 4-8
choose 1-4
clear async statement 4-10
clear cursor statement 2-21
clear statement B-5, 2-16, 2-18, 2-21, 4-9
clearing
cursors 4-9
dynamic statements 4-9
client process 5-20
IN - 4
Index
data type
RIS_BLOB A-8
RIS_TEXT A-8
databases
multiple schemas in A-6
retrieving information 5-35
datetime structure 5-3, 5-8 5-9, 5-11
dbca pointer B-4, 2-10
dblistp pointer 5-32
dbms_owner A-4
dbp pointer 5-23, 5-35
declare cursor statement 4-12
declare schema statement A-5
declare statement 2-16, 2-21
declaring
cursors 4-12
host variables 4-19
tables B-3
variables 4-8, 4-19
views B-3
virtual variables 4-19
define statement 4-13
definition of schema in RIS 5 A-3
delete statement B-5, B-7
describe statement 2-18, 2-21, 4-14
dictionary
adding schemas to A-6
creating A-6
creation A-6
objects A-6
shared A-6
views
accessing from application A-7
information in A-7
dictionary access form 6-3
display form functions 6-11
displayed forms functions 6-10
document conventions 1-3
double data type 4-8
drop schema form 6-3
drop statement B-7
drop table form 6-3
dropping schemas A-6
dsklayt2 D-3
dynamic SQL statements
ANSI standard 2-4
future changes 2-4
dynamic statements 2-14
clearing 4-9
cursor 2-21
executing 4-21 4-22
Index IN - 5
forms (continued)
include files 6-3
include form 6-3
initialize 6-4
libraries 6-3
modify DB2 password form 6-3
modify node info form 6-3
modify schema password form 6-3
ris database form 6-3
RIS schema manager 6-3
RISforms.h include file 6-4
RISfrm_alter_table_form_displayed 6-10
RISfrm_create_schema_form_displayed
6-10
RISfrm_create_table_form_displayed
6-10
RISfrm_data_def_form_displayed 6-10
RISfrm_db2pass_form_displayed 6-10
RISfrm_dict_access_form_displayed 6-10
RISfrm_display_alter_table_form 6-11
RISfrm_display_create_schema_form
6-11
RISfrm_display_create_table_form 6-11
RISfrm_display_data_def_form 6-11
RISfrm_display_db2pass_form 6-11
RISfrm_display_dict_access_form 6-11
RISfrm_display_drop_schema_form 6-11
RISfrm_display_drop_table_form 6-11
RISfrm_display_exclude_form 6-11
RISfrm_display_include_form 6-11
RISfrm_display_locate_client_form 6-11
RISfrm_display_node_info_form 6-11
RISfrm_display_ris_dbs_form 6-11
RISfrm_display_schema_access_form
6-11
RISfrm_display_schema_definition_form
6-11
RISfrm_display_schema_file_form 6-11
RISfrm_display_schema_info_form 6-11
RISfrm_display_schema_mgr_form 6-11
RISfrm_display_schpass_form 6-11
RISfrm_display_set_form 6-11
RISfrm_display_table_info_form 6-11
RISfrm_drop_schema_form_displayed
6-10
RISfrm_drop_table_form_displayed 6-10
RISfrm_erase_alter_table_form 6-12
RISfrm_erase_create_schema_form 6-12
RISfrm_erase_create_table_form 6-12
RISfrm_erase_data_def_form 6-12
RISfrm_erase_db2pass_form 6-12
IN - 6
Index
forms (continued)
RISfrm_erase_dict_access_form 6-12
RISfrm_erase_drop_schema_form 6-12
RISfrm_erase_drop_table_form 6-12
RISfrm_erase_exclude_form 6-12
RISfrm_erase_include_form 6-12
RISfrm_erase_locate_client_form 6-12
RISfrm_erase_node_info_form 6-12
RISfrm_erase_ris_dbs_form 6-12
RISfrm_erase_schema_access_form 6-12
RISfrm_erase_schema_definition_form
6-12
RISfrm_erase_schema_file_form 6-12
RISfrm_erase_schema_info_form 6-12
RISfrm_erase_schema_mgr_form 6-12
RISfrm_erase_schpass_form 6-12
RISfrm_erase_set_form 6-12
RISfrm_erase_table_info_form 6-12
RISfrm_exclude_form_displayed 6-10
RISfrm_include_form_displayed 6-10
RISfrm_initialize 6-4
RISfrm_init_parms data type 6-4
RISfrm_locate_client_form_displayed
6-10
RISfrm_node_info_form_displayed 6-10
RISfrm_ris_dbs_form_displayed 6-10
RISfrm_schema_access_form_displayed
6-10
RISfrm_schema_definition_form_displayed
6-10
RISfrm_schema_file_form_displayed
6-10
RISfrm_schema_info_form_displayed
6-10
RISfrm_schema_mgr_form_displayed
6-10
RISfrm_schpass_form_displayed 6-10
RISfrm_set_form_displayed 6-10
RISfrm_table_info_form_displayed 6-10
schema definition form 6-3
schema file form 6-3
schema information form 6-3
schema manager 6-3
schema manager form 6-3
secure schema access form 6-3
set form 6-3
Set Functions 6-9
table information form 6-3
Forms Functions Error Handling 6-13
free function 5-23, 5-35
functions 5-3
example programs 5-7
free 5-35
include files 5-7
libraries 5-7
load 7-31
RISascii_to_datetime 5-8
RISdatetime_to_ascii 5-9
RISget_ansi_mode 5-13
RISget_app_version 5-14
RISget_async_stmts 5-15
RISget_autocommit_mode 5-17
RISget_autorename_mode 5-18
RISget_blankstrip_mode 5-19
RISget_client_location 5-20
RISget_current_stmt_schema_name
5-22
RISget_dbca 5-25
RISget_db_info 5-4, 5-23
RISget_default_schema_name 5-26
RISget_enabled_databases 5-27
RISget_language_name 5-29
RISget_parameters 5-30
RISget_risca 5-31
RISget_ris_sqltype_code 5-44
RISget_ris_sqltype_string 5-45
RISget_schema_file 5-32
RISget_schema_file_location 5-37
RISget_schema_info 5-35
RISget_schema_names 5-39
RISget_schema_transactions 5-42
RISget_sqlcode 5-46
RISget_verify_mode 5-47
RISinitialize B-4, 5-48
RIS_loader 7-31
RISlocate_client 5-49
RISlocate_schema_file 5-51
rislod_fprint 7-32
rislod_print 7-33
RISrestore_schema_file_checksum 5-53
RISstart_client 5-54
RISstop_client 5-55
RISterminate B-4, 5-56
risuld_fprint 7-33
risuld_print 7-34
RIS_unloader 7-31
unload 7-32
G
GRANT CONNECT TO A-5
Index IN - 7
L
language configuration file C-3
libraries 2-5
for forms 6-4
for functions 5-7
for loading and unloading 7-4 7-5
for SQL 4-6
linking 2-5
load
definition 7-3
load and unload
include files 7-4
libraries 7-5
load and unload example programs 7-5
lock tables statement B-4
locking B-4
explicit B-4
implicit B-4
table 2-23
locks B-4
exclusive B-4
shared B-4
types B-4
long binary data A-8
long text data A-8
M
macros 5-27
malloc 4-16, 5-23, 5-32, 5-35
managing statements B-5
manifes1.txt D-5
MAX_STATIC_STMTS parameter B-5
MAX_TRANSACTIONS 2-24
message boxes 2-6
modes
autocommit B-7
setting verify B-6
modify DB2 password form 6-3
modify node info form 6-3
modify schema password form 6-3
mouse 1-3
multiple transactions 2-23
N
names, aliases A-4
noncursor statements 2-14
not null keywords 2-12
note symbol 1-5
NULL values 2-12
IN - 8
Index
O
object files 2-5
objects
aliases A-4
dictionary A-6
of different owners within a schema A-3
ownership A-3
sharing among schemas A-3
on-line Help 1-5
on-line help 2-4
open cursor statement 2-21
open statement 2-16, 2-21, 4-27
opening
cursors 4-27
operators
UNION and UNION ALL A-3
order by statements B-5
ownership of objects A-3
P
parameterizing dynamic statements 2-19
using a question mark (?) 2-12
parameters
MAX_STATIC_STMTS B-5
parameters file B-5, 4-31, 5-37, 5-49, 5-51
parms file 5-51
parts of the Help window 1-5
passwords
RIS A-5
stored for schema A-5
PATH D-6
pc conventions 1-5
performance considerations B-3
pointers
buffer 5-39
countp 5-39
dbca B-4
dblistp 5-32
dbp 5-23, 5-35
granteep 5-32, 5-35
risca B-4
schemap 5-35
schlistp 5-32
prepare statement 2-18, 2-21, 4-28
preparing dynamic statements 4-28
preparing statements B-5
preprocessing statements
compiler directives 4-13, 4-18, 4-20,
4-24 4-26, 4-34
preprocessor 2-5
file extension 2-5
preprocessor (continued)
graph 2-7
invoking 2-5
options 2-5
return value 2-5
privileged accounts
including data owned by A-3
program interface 2-3
programming notes B-3
Q
queries
changing object names A-6
quick reference 4-3
R
RDBMS 2-3
logins A-5
security tracking A-5
versions, compatible with RIS 5 A-3
ReadInfFile D-3
readme1.txt D-5
record identifiers B-7
redistribution of RIS runtime and RIS
utilities D-3
RegEdtRIS D-4
RegRemoveRIS D-5
relational database management system
2-3
relational interface system 2-3
RemoveRIS D-5
report error statement B-4, 2-9, 4-29
reporting errors 4-29
requesting information
errors 4-29
input parameters 4-14
output results 4-14
required products 2-4
reset 1-4
retrieving
large data A-8
REVOKE CONNECT FROM A-5
REVOKE RESOURCE FROM A-5
REVOKE SCHEMA FROM A-6
RIS
compatibility 2-3
definition 2-3
embedded SQL 2-3
forms functions 6-3
initializing B-4
introduction to 2-3
Index IN - 9
RIS (continued)
load 7-3
object ownership A-3
password storage A-5
preprocessor 2-5
program interface 2-3
related documentation 1-3
schema manager 6-3
shared component directory structure
D-3
supported platforms 2-4
terminating B-4
unload 7-3
versions
interoperability A-11
RIS client processes B-4
termination of B-12
RIS connections B-6
ris database form 6-3
RIS Development Platform
capabilities provided 2-3
RIS embedded SQL statements 4-6
risalpha utility A-12
RISascii_to_datetime 5-8
RIS_BLOB A-8
ris_blob 3-3
risca pointer B-4, 2-9
RISCLI 5-37
riscpp.exe 2-5
file extension 2-5
graph 2-7
invoking 2-5
libraries 2-5
linking 2-5
object files 2-5
options 2-5
return value 2-5
RISdatetime_to_ascii 5-9
ris_db2_info structure 5-4
ris_db_info structure 5-4
risdbms_indexes A-7
risdbms_tables A-7
risdbms_views A-7
risforms.lib library 2-6
RISfrm_alter_table_form_displayed 6-10
RISfrm_create_schema_form_displayed
6-10
RISfrm_create_table_form_displayed 6-10
RISfrm_data_def_form_displayed 6-10
RISfrm_db2pass_form_displayed 6-10
RISfrm_dict_access_form_displayed 6-10
RISfrm_display_alter_table_form 6-11
RISfrm_display_create_schema_form 6-11
RISfrm_display_create_table_form 6-11
RISfrm_display_data_def_form 6-11
RISfrm_display_db2pass_form 6-11
RISfrm_display_dict_access_form 6-11
RISfrm_display_drop_schema_form 6-11
RISfrm_display_drop_table_form 6-11
RISfrm_display_exclude_form 6-11
RISfrm_display_include_form 6-11
RISfrm_display_locate_client_form 6-11
RISfrm_display_node_info_form 6-11
RISfrm_display_ris_dbs_form 6-11
RISfrm_display_schema_access_form 6-11
RISfrm_display_schema_definition_form
6-11
RISfrm_display_schema_file_form 6-11
RISfrm_display_schema_info_form 6-11
RISfrm_display_schema_mgr_form 6-11
RISfrm_display_schpass_form 6-11
RISfrm_display_set_form 6-11
RISfrm_display_table_info_form 6-11
RISfrm_drop_schema_form_displayed 6-10
RISfrm_drop_table_form_displayed 6-10
RISfrm_erase_alter_table_form 6-12
RISfrm_erase_create_schema_form 6-12
RISfrm_erase_create_table_form 6-12
RISfrm_erase_data_def_form 6-12
RISfrm_erase_db2pass_form 6-12
RISfrm_erase_dict_access_form 6-12
RISfrm_erase_drop_schema_form 6-12
RISfrm_erase_drop_table_form 6-12
RISfrm_erase_exclude_form 6-12
RISfrm_erase_include_form 6-12
RISfrm_erase_locate_client_form 6-12
RISfrm_erase_node_info_form 6-12
RISfrm_erase_ris_dbs_form 6-12
RISfrm_erase_schema_access_form 6-12
RISfrm_erase_schema_definition_form 6-12
RISfrm_erase_schema_file_form 6-12
RISfrm_erase_schema_info_form 6-12
RISfrm_erase_schema_mgr_form 6-12
RISfrm_erase_schpass_form 6-12
RISfrm_erase_set_form 6-12
RISfrm_erase_table_info_form 6-12
RISfrm_exclude_form_displayed 6-10
RISfrm_include_form_displayed 6-10
RISfrm_initialize 6-4
RISfrm_init_parms data type 6-4
IN - 10
Index
RISfrm_locate_client_form_displayed 6-10
RISfrm_node_info_form_displayed 6-10
RISfrm_ris_dbs_form_displayed 6-10
RISfrm_schema_access_form_displayed
6-10
RISfrm_schema_definition_form_displayed
6-10
RISfrm_schema_file_form_displayed 6-10
RISfrm_schema_info_form_displayed 6-10
RISfrm_schema_mgr_form_displayed 6-10
RISfrm_schpass_form_displayed 6-10
RISfrm_set_form_displayed 6-10
RISfrm_table_info_form_displayed 6-10
RISget_ansi_mode 5-13
RISget_app_version function 5-14
RISget_async_stmts 5-15
RISget_autocommit_mode 5-17
RISget_autorename_mode 5-18
RISget_blankstrip_mode 5-19
RISget_client_location 5-20
RISget_current_stmt_schema_name 5-22
RISget_dbca 5-25
RISget_db_info 5-4, 5-23
RISget_default_schema_name 5-26
RISget_enabled_databases 5-27
RISget_language_name 5-29
RISget_parameters 5-30
RISget_risca 5-31
RISget_ris_sqltype_code 5-44
RISget_ris_sqltype_string 5-45
RISget_schema_file 5-32
RISget_schema_file_location 5-37
RISget_schema_info 5-35
RISget_schema_names 5-39
RISget_schema_transactions 5-42
RISget_sqlcode 5-46
RISget_verify_mode 5-47
ris_grantee_info structure 5-6
risgui utility A-12
ris.h 5-27
ris_ifx_info structure 5-4
ris_igs_info structure 5-4
RISinitialize B-4, 5-48
RIS_LANGUAGE 2-5
rislduld.lib library 2-6
ris.lib library 2-6
rislimit.h include file 5-39
RISlimits.h 5-39
RIS_loader functions 7-31
RISlocate_client 5-49
RISlocate_schema_file 5-51
rislod 7-3
interfacing with 7-31
risloddbs structure 7-5, 7-8
input fields 7-8
risloddes structure 7-3, 7-5, 7-31
default values 7-27
directions for using 7-27
input fields 7-6
loading RIS objects 7-28
output fields 7-7
printing fields 7-32 7-33
printing status of 7-28
return information 7-3
rislodgrant structure 7-8, 7-16
input fields 7-16
output fields 7-16
rislodindx structure 7-8, 7-15
input fields 7-15
output fields 7-15
rislodsch structure 7-5, 7-8
input fields 7-8
output fields 7-12
rislodtab structure 7-8, 7-13
default values 7-27
input fields 7-13
output fields 7-13
rislodview structure 7-8, 7-14
input fields 7-14
output fields 7-14
RISNET connection B-6
ris_object A-7
ris_ora_info structure 5-4
ris_parameters structure 5-6
ris_rdb_info structure 5-4
risrem.lib D-4
RISrestore_schema_file_checksum 5-53
ris_schema_info structure 5-7
rissetup.lib D-3
rissetup.lyt D-3
rissqlca structure B-4
RISstart_client 5-54
RISstop_client 5-55
RIS_SUCCESS 6-11 6-12
RISterminate B-4, 5-56
RIS_TEXT A-8
ris_text 3-6
risulddbs structure 7-17
risulddes structure 7-4, 7-17, 7-32
directions for using 7-27
input fields 7-18
Index IN - 11
schemas (continued)
sharing objects among A-3
usernames stored for A-5
schlistp pointer 5-32
secure schema access form 6-3
secure schemas A-5
security A-5
tracking, RDBMS A-5
violations, including data without A-3
select 1-4
select into statement B-5, 4-30
select statement A-3, B-7
selecting rows and columns 4-30
semaphore sets B-4
sequences, exclude/include A-4
set database statement 5-27
set form 6-3
Set Functions 6-9
setting verify mode B-6
setup files D-3
SetupRIS D-4
SETUPSDK D-3
Shamrock DLL 2-6
shared component D-3
shared component location D-6
shared component registry information D-7
shared dictionaries A-6
shared memory segments B-4
short data type 4-8
signals
SIGCLD B-12
using B-12
software changes A-3
software, required 2-4
SQL
definition 2-3
example programs 4-6
executing static statements 4-31
include files 4-6
libraries 4-6
SQL Interface 2-24
SQL statement
hints B-12
SQL statements
alter B-7
clear B-5
commit B-7
create B-7
cursor B-5
delete B-5, B-7
drop B-7
IN - 12
Index
structures (continued)
ris_ifx_info 5-4
ris_igs_info 5-4
risloddbs 7-5, 7-8
risloddes 7-3, 7-5, 7-27, 7-31 7-33
rislodgrant 7-8, 7-16
rislodindx 7-8, 7-15
rislodsch 7-5, 7-8
rislodtab 7-8, 7-13
rislodview 7-8, 7-14
ris_ora_info 5-4
ris_parameters 5-6
ris_rdb_info 5-4
ris_schema_info 5-7
rissqlca B-4
risulddbs 7-17
risulddes 7-4, 7-17, 7-32 7-34
risuldgrant 7-19, 7-26
risuldindx 7-19, 7-25
risuldsch 7-17, 7-19
risuldtab 7-19, 7-23
risuldview 7-19, 7-24
schema_file_parms 5-6
sqlda 4-14
sqlvar 4-14 4-15
symbol
caution 1-5
note 1-5
warning 1-5
T
table information form 6-3
table locking 2-23
tables
creating logical groupings A-3
declaring B-3
preparing B-7
temporary B-7
with same name A-4
with same name in one schema A-4
terminating B-4
explicit B-4
test completion statement 4-32
text data A-8
text data type 3-3
transactions B-7
U
UMS DLL 2-6
UMS library
embedded SQL statements 2-5
Index IN - 13
IN - 14
Index