Contents
Miscellaneous Functions
Purpose:
To compare two groups of contiguous bytes, for a specified length,
byte-by-byte.
Syntax:
mint bycmpr(char *st1, char *st2, mint count);
Notes:
- st1 is a pointer to the location where the first group of bytes
starts.
- st2 is a pointer to the location where the second group of bytes
starts.
- count is the number of bytes to compare.
Return code:
0 The two groups are
identical.
-1 The st1 group is less than the
st2 group.
+1 The st1 group is greater than the
st2
group.
Purpose:
Returns the number of bytes in a string, omitting trailing blanks
Syntax:
mint byleng(char *beg, mint cnt);
Notes:
- beg is a pointer to a fixed-length string, not null-terminated.
- cnt is the number of bytes in the string, not including trailing
blanks.
Purpose:
To copy a specified number of bytes to another location
Syntax:
void bycopy(char *s1, char *s2, mint n);
Notes:
- s1 is a pointer to the first byte of the group of bytes that you
want to copy.
- s2 is a pointer to the first byte of the destination group of
bytes. If the location pointed to by s2 overlaps the location
pointed to by s1, FESQLC will not preserve the value of s1.
- n is the number of bytes to be copied.
Warning: Do not overwrite the memory areas
adjacent to the destination area.
Purpose:
To fill a specified number of bytes with a specified character
Syntax:
void byfill(char *s1, mint n, char c);
Notes:
- s1 is a pointer to the first byte of the memory area that you
want to fill.
n is the number of times that you want to repeat the character within
the area.
c is the character that you want to use to fill the area.
Warning: Do not overwrite the memory areas
adjacent to the destination area.
Purpose:
To check whether a C or FESQLC variable is null
Syntax:
int risnull(int vtype, char *pcvar);
Notes:
- vtype is an integer corresponding to the data type of the
variable; see the Data Type Constants in the Data Types chapter for additional information.
- pcvar is a pointer to the C or FESQLC variable.
Return code:
1 The variable does contain a null value.
0 The variable does not contain a null value.
Purpose:
To set a C or FESQLC variable to NULL
Syntax:
mint rsetnull(mint vtype, char *pcvar);
Notes:
- type is an integer corresponding to the data type of the
variable; see the Data Type Constants in the Data Types chapter for additional information.
- pcvar is a pointer to the C or FESQLC variable.
rgetmsg()
Informix Only!
Purpose:
Returns the error message for a specified error number, restricted to
two-byte integers.
Syntax:
mint rgetmsg(int msgnum, char *s, mint maxsize);
Notes:
- msgnum is the error number, restricted to error numbers between
-32768 and +32767.
- s is a pointer to the buffer that receives the message string
(the output buffer).
- maxsize is the size of the output buffer. This value should be
set to the size of the largest message that you expect to retrieve.
- The Informix message text files are used to retrieve the message.
Return code:
0 The conversion was
successful.
-1227 Message file not found.
-1228 Message number not found in message file.
-1231 Cannot seek within message file.
-1232 Message buffer is too small.
rgetlmsg()
Informix Only!
Purpose:
Returns the error message for a specified error number, which can be a 4-byte
integer.
Syntax:
int4 rgetlmsg(int msgnum, char *s, mint maxsize, mint *msg_length);
Notes:
- msgnum is the error number. The four-byte parameter provides for
the full range of Informix-specific error numbers.
- s is a pointer to the buffer that receives the message string
(the output buffer).
- maxsize is the size of the msgstr output buffer. Make this value
the size of the largest message that you expect to retrieve.
- msg_length is a pointer to the mint that contains the actual
length of the message that rgetlmsg() returns.
Purpose:
Returns the position to align a variable at the proper boundary for its data
type
Syntax:
32-bit
mint rtypalign(mint pos, mint datatype)
64-bit
mlong rtypalign(mlong pos, mint datatype)
Notes:
- pos is the current position in the buffer.
- datatype is an integer that corresponds to the data type of a C or
FESQLC variable. See Data Type Constants.
Return code:
>0 The return value is the offset of the next proper
boundary for a variable of type data type.
Purpose:
Returns the size in bytes required for a specified data type
Syntax:
mint rtypmsize(mint datatype, mint length)
Notes:
- datatype is an integer representing the C or FESQLC data type.
See Data Type Constants.
- length is the number of bytes in the data file for the specified
type.
Return code:
0 The datatype is not a valid SQL type.
>0 The return value is the number of bytes that the data type
requires.
Purpose:
Returns a pointer to a null-terminated string containing the name of the data
type
Syntax:
mint *rtypname(mint datatype)
Notes:
- datatype is an integer code for one of the C or FESQLC data
types. See Data Type Constants.
- The rtypname function returns a pointer to a string that contains the
name of the data type specified datatype. If datatype is an
invalid value, rtypname()
returns a null string (" ").
Purpose:
Returns the minimum number of characters required to convert a specified data
type to a character data type
Syntax:
mint rtypwidth(mint datatype, mint length)
Notes:
- datatype is an integer code for one of the C or FESQLC data
types. See Data Type Constants.
- length is the number of bytes in the data file for the specified
data type.
Return code:
0 The sqltype is not a valid SQL data type.
> 0 The return value is the minimum number of characters that the sqltype
data type requires.