Adam Cameron
allowMultiQueries
setting passed in the connection string).thisOldDave
02/15/2022, 11:43 AMgetApplicationMetadata()
if that is no good then getpagecontext().getConfig().getDatasource("dsourcename").getConnectionStringTranslated()
Adam Cameron
getApplicationMetadata
isn't the object but it'll do. And cheers for the other option.Adam Cameron
getConfig
doesn't seem to be part of the standard PageContext spec, but is implemented in Lucee's lucee.runtime.PageContext
class. On the https://docs.lucee.org/reference/functions/getpagecontext.html docs page there's a link to https://javadoc.lucee.org/lucee/runtime/PageContext.html, am I safe to assume that API is intended to be used in our applications, and accordingly is subject to the usual stability "guarantees" that the CFML parts of Lucee has (eg in https://docs.lucee.org/).
I guess the question is just clarifying that it's not considered "internal implement detail" and subject to change at the whim of the Lucee dev team as their needs dictate?thisOldDave
02/15/2022, 12:19 PMthisOldDave
02/15/2022, 12:21 PMgetDatasource()
methodAdam Cameron
<cfadmin>
works, it's only good for getting stuff actually set in the admin. These DSNs are application-set.
The metadata approach is fine for my purposes.thisOldDave
02/15/2022, 12:23 PMAdam Cameron
Adam Cameron
<cfadmin action="getDebugData" returnvariable="debug_data">
... no pwd needed.
getDatasource
did need the pwd though.thisOldDave
02/15/2022, 12:29 PM<cfset dataSource = getPageContext().getDatasource(datasourceName)>
<cftry>
<cfset details["Database"] = dataSource.getDatabase()>
<cfcatch>
<!--- if the datasource is defined in Application.cfc getDatabase() will error --->
<cfset details["Database"] = CreateObject("java", "lucee.runtime.services.DataSourceImpl").init(dataSource).getconnection().getCatalog()>
</cfcatch>
</cftry>