This commit is contained in:
msyu
2025-09-19 10:30:16 +03:00
parent 036fa7b227
commit bcc8fa22ed
+12 -7
View File
@@ -29,11 +29,14 @@
<cfset request.language=""> <cfset request.language="">
<!--- кажется, нужно инициализировать датасорцы в псевдоконструкторе - onRequest не получается ---> <!--- кажется, нужно инициализировать датасорцы в псевдоконструкторе - onRequest не получается --->
<!--- *** проверить, что есть - если есть, не создавать ---> <!--- *** проверить, что есть - если есть, не создавать --->
<!--- но так не работает ---> <!--- не тут-то было: так не работает --->
<!--- <cfif NOT structKeyExists(this.datasources,this.datasource)> <!--- <cfif NOT structKeyExists(this.datasources,this.datasource)>
<cfset this.datasources["#this.datasource#"]=getDS("#this.datasource#","ds_#this.datasource#")/>
</cfif> ---> </cfif> --->
<!--- это работает с административно заданным датасорцем, хотя, казалось бы, не должно
(без окружения фунекция вернет пустую структуру). Видимо, административный датасорц обнаруживается раньше.
Проверять на пустоту не хочется, чтобы не плодить в псевдоконструкторе переменные --->
<cfset this.datasources["#this.datasource#"]=getDS("#this.datasource#","ds_#this.datasource#")/>
<!--- <cfdump var=#variables#/> ---> <!--- <cfdump var=#variables#/> --->
@@ -76,7 +79,7 @@
<!--- global settings ---> <!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/> <cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.005"/> <cfset request.APP_VERSION="0.00.006"/>
<cfset request.STAND=getStand()/> <cfset request.STAND=getStand()/>
<!--- application constants ---> <!--- application constants --->
@@ -350,7 +353,7 @@
select 1; select 1;
</cfquery> </cfquery>
<cfcatch type="database"> <cfcatch type="any">
<cfset system = createObject("java", "java.lang.System")/> <cfset system = createObject("java", "java.lang.System")/>
<cfloop list="class,connectionString,database,driver,dbdriver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field"><!--- driver vs dbdriver ---> <cfloop list="class,connectionString,database,driver,dbdriver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field"><!--- driver vs dbdriver --->
@@ -362,8 +365,6 @@
<cfif structIsEmpty(ds)> <cfif structIsEmpty(ds)>
<cfthrow type="application" message="Datasource not configured" detail="Datasource not defined in the environment. Expected prefix is #arguments.prefix#"/> <cfthrow type="application" message="Datasource not configured" detail="Datasource not defined in the environment. Expected prefix is #arguments.prefix#"/>
</cfif> </cfif>
</cfcatch>
</cftry>
<!--- test datasource (just to get exception if invalid) ---> <!--- test datasource (just to get exception if invalid) --->
<cftry> <cftry>
@@ -373,10 +374,14 @@
<cfcatch type="any"> <cfcatch type="any">
<!--- <cfdump var=#ds#/><cfabort/> ---> <!--- <cfdump var=#ds#/><cfabort/> --->
<cfdump var=#arguments#/>
<cfdump var=#ds#/>
<cfrethrow/> <cfrethrow/>
</cfcatch> </cfcatch>
</cftry> </cftry>
</cfcatch>
</cftry>
<cfdump var=#ds#/>
<cfreturn ds/> <cfreturn ds/>
</cffunction> </cffunction>