getSchema( ) example
The following class subclasses the Database class to provide support for RapidFile tables. The code shown here implements the getSchema( ) method:
class RapidFileDatabase of Database
this.path = ""
function getSchema( cArg )
local cItem
cItem = upper( cArg )
do case
case cItem == "DATABASES"
return super::getSchema( "DATABASES" )
case cItem == "TABLES"
local aRet, nFiles
aRet = new Array( )
nFiles = aRet.dir( this.path + "*.RPD" ) // Get all RapidFile files
if nFiles > 0
aRet.resize( nFiles, 1, 1 ) // Filenames only in 2-D array
aRet.resize( nFiles, 0 ) // Convert to 1-D array
endif
return aRet
case cItem == "PROCEDURES" or cItem == "VIEWS"
return new Array( )
otherwise
return super::getSchema( cItem )
endcase
endclass