new (Class method)



An ooSQLPackage object can not be instantiated from Rexx code. Rather, the programmer uses the getPackage method of the ooSQLExtensions class to get a package object.

Remarks: In general an external ooSQLite package is loaded through the loadPackage method of theooSQLExtensionsclass. For many use cases, this may be sufficient. Some use cases, such as registering a single function from the package to a specific database connection, require the package object. The loaded package object can be obtained through thegetPackagemethod.
Details Raises an error condition if invoked from Rexx code.
Example: This example is from a program where only a single function in an ooSQLite package is needed to be registered with a database connection:
-- Load the package
success = .ooSQLExtensions~loadPackage(packageFile)
if \\ success then do
say 'Failed to load package'
say ' Error code: ' .ooSQLExtensions~lastErrCode
say ' Error message:' .ooSQLExtensions~lastErrMsg
return .ooSQLExtensions~lastErrCode
end
...
dbConn = .ooSQLiteConnection~new(dbName, .ooSQLite~OPEN_READWRITE)
-- Get the package and register a single function
package = .ooSQLExtensions~getPackage('examplePackage')
function = package~getFunction('half')
if function == .nil then do
say 'Failed to get function: half'
say ' Error code: ' package~lastErrCode
say ' Error message:' package~lastErrMsg
return package~lastErrCode
end
dbConn~createFunction('half', function)