KI_DB_NAME

Convert tablename to a database object name (or filename)

Synopsis:
CALL KI_DB_NAME connection, Tablename$, Tablespace$, SYM(out_name$) TO status
status = 'ki_db_name( connection, Tablename$, Tablespace$, SYM(out_name$) )
ArgumentEnumerationPurpose
connectionDatabase connection number
Tablename$Table name
Tablespace$Table space name
SYM(out_name$)Symbol of output buffer
statusKDB_ERROR_ENUMReturn status
>KI_DB_NAME

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 SUB
Should 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
History
Introduced in KCML 6.60
See Also:
KI_CLOSE, KI_CLOSE_TABLE, KI_DROP_TABLE, KI_EXTEND, KI_GET_HANDLE, KI_GET_SERIAL, KI_INFO, KI_INITIALISE, KI_LOCK_ALL, KI_OPEN, KI_PREFETCH_ROWS, KI_REBUILD, KI_RESET_CACHEID, KI_SET_DATESTAMP, KI_SET_SERIAL, KI_SET_TIMESTAMP, KI_SET_USERSTAMP, KI_UNLOCK_FILE, KI_VERIFY
KCML database status codes