component {
this.datasources[ 'first_dsn' ] = {
/* valid datasource definition */
};
this.sessionCluster = true;
this.sessionStorage = 'first_dsn';
this.defaultDatasource = 'second_dsn';
public boolean function onRequestStart(
required string targetPage
) {
setupSecondDatasource();
QueryExecute( sql=" ... " ); // Errors because second_dsn (default ) is not defined
return true;
}
public void function setupSecondDatasource() {
this.datasources[ 'second_dsn' ] = {
/* valid datasource definition */
};
}
}
component {
this.defaultDatasource = 'second_dsn';
public boolean function onRequestStart(
required string targetPage
) {
setupSecondDatasource();
QueryExecute( sql=" ... " ); // Works fine
return true;
}
public void function setupSecondDatasource() {
this.datasources[ 'second_dsn' ] = {
/* valid datasource definition */
};
}
}
component {
public boolean function onRequestStart(
required string targetPage
) {
setupDatasources();
QueryExecute( sql=" ... " ); // Errors because second_dsn (default ) is not defined
return true;
}
public void function setupDatasources() {
Application
action = 'update'
datasources = {
'first_dsn': { /* valid dsn */ },
'second_dsn': { /* valid dsn */ }
},
defaultDatasource = 'second_dsn',
sessionStorage = 'first_dsn'
sessionCluster = true;
}
}
Igal Sapir
Lucee Core Developer
Lucee.org
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/89121714-6862-44c2-b3af-ac9f4f63adc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.