Free a sort order structure allocated by dbloadsort.
RETCODE dbfreesort(dbproc, sortorder) DBPROCESS *dbproc; DBSORTORDER *sortorder;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.
A pointer to a DBSORTORDER structure allocated through dbloadsort.
SUCCEED or FAIL.
dbfreesort frees a sort order structure that was allocated using dbloadsort. DB-Library routines such as dbstrcmp and dbstrsort use sort orders to determine how character data must be sorted.
When an application program does sorting or comparing, it automatically sorts character data the same way the server does. If no sort order has been loaded, routines such as dbstrcmp and dbstrsort sort characters by their binary values.
WARNING! Application programs must not attempt to use operating-system facilities to free the *sortorder structure directly, as it may have been allocated using some mechanism other than malloc (on operating systems where malloc is not supported), and it may consist of multiple parts, some of which must be freed separately.
The following code fragment illustrates the use of dbfreesort:
sortorder = dbloadsort(dbproc);
retval = dbstrcmp(dbproc, "ABC", 3, "abc", 3,
sortorder);
printf("ABC dbstrcmp’ed with abc yields %d.\n",
retval);
retval = dbstrcmp(dbproc, "abc", 3, "ABC", 3,
sortorder);
printf("abc dbstrcmp’ed with ABC yields %d.\n",
retval);
dbfreesort(dbproc, sortorder);