KI_DB_NAME
Argument | Enumeration | Purpose |
---|---|---|
connection | Database connection number | |
Tablename$ | Table name | |
Tablespace$ | Table space name | |
SYM(out_name$) | Symbol of output buffer | |
status | KDB_ERROR_ENUM | Return status |
KI_DB_NAME
This function is used to test the translation from application table name to database object name and back again. This is the same translation used by CREATE TABLE and KI_OPEN. The absolute value of the connection handle must be a valid database connection. If the connection handle is positive then the conversion is FROM an application table name, if it is negative then the translation is back TO an application table name. The tablespace may have <source_image> and <object_image> specified in kconf.xml, in which case they are used otherwise a hard-wired translation is used, equivalent to:
<source_image>MM_CC_NNNNNN[_BBBBBBBB][_UUUUUUUUUUUU]</source_image> <object_image>/MM/CC/MM_CC_NNNNNN[_BBBBBBBB][_UUUUUUUUUUUU]</object_image>
For Example:
After adding the following to kconf.xml<tablespace> <name>TEST1</name> <location>.</location> <type>tree</type> <access>read write</access> </tablespace> <tablespace> <name>TEST2</name> <location>/tmp</location> <type>tree</type> <access>read write</access> <source_image>MM_CC[-BBBBBBBB]_NNNNNNNN[_TT][-UUUUUUUU][.EEE]</source_image> <object_image>/MM/CC/MM_CC[+BBBBBBBB]_NNNNNNNN[_TT][-UUUUUUUU][.EEE]</object_image> </tablespace>The following code
: DIM buf$1024,buf2$1024,ki_status : CALL KI_DB_NAME ki_connect,"GB_00_users","TEST1",SYM(buf$) TO ki_status : PRINT buf$ : CALL KI_DB_NAME -ki_connect,buf$,"TEST1",SYM(buf2$) TO ki_status : PRINT buf2$ : buf$ = " " : buf2$ = " " : CALL KI_DB_NAME ki_connect,"SO_01-0001_fred_BS-BERT","TEST2",SYM(buf$) TO ki_status : PRINT buf$ : CALL KI_DB_NAME -ki_connect, buf$, "TEST2", SYM(buf2$) TO ki_status : PRINT buf2$ : RETURN : END SUBShould produce the following output
./GB/00/GB_00_USERS GB_00_USERS /tmp/SO/01/SO_01+0001_fred_BS-BERT SO_01-0001_fred_BS-BERT