buildStatements method
Returns a list with the SQL statements to set each runtime parameters.
If isLocal is true, options are set for the current transaction only.
Implementation
Iterable<String> buildStatements({required bool isLocal}) => options.entries
.map((e) {
var value = e.value;
if (value is String) value = ValueEncoder.instance.convert(value);
if (value is RuntimeParameters) return value.build(isLocal: isLocal);
if (value is IterativeScan) value = value.alias;
if (value is bool) value = (value == true) ? 'on' : 'off';
if (value == null) {
value = 'TO DEFAULT';
} else if (this is SearchPathsConfig) {
value = (value as List<String>)
.map((s) => ValueEncoder.instance.convert(s))
.join(', ');
value = 'TO $value';
} else {
value = '= $value';
}
return 'SET ${isLocal ? 'LOCAL ' : ''}${e.key} $value;';
})
.where((e) => e != '');