I’m trying to create a datasource programmatically and append to the connection string. I need to add the following MSSQL connection string: “DateTimeInputParameterType=dateTime” to make preserve sending datetime params as “datetime” and not “datetime2” values.
Looking at the documentation, it would appear I should be able to pass the following to the updateDatasource() method of the Administrator.cfc:
“custom”: “DateTimeInputParameterType=dateTime”
However, the actual component (Lucee/Administrator.cfc at 7d73d7357de7a0b0e91d7b7df27b37aa6171d67c · lucee/Lucee · GitHub ) does not seem to support this.
Or should it be:
customDateTimeInputParameterType=“dateTime”
custom needs to be a struct, but the var custom=structNew();
should go, rather updateDatasource should accept custom as an argument
custom = { DateTimeInputParameterType":"dateTime" }
customDateTimeInputParameterType="dateTime"
should work tho
boolean customTinyInt1isBit=false,
boolean customUseLegacyDatetimeCode=false
){
var driverNames=structnew("linked");
driverNames=ComponentListPackageAsStruct("lucee-server.admin.dbdriver",driverNames);
driverNames=ComponentListPackageAsStruct("lucee.admin.dbdriver",driverNames);
driverNames=ComponentListPackageAsStruct("dbdriver",driverNames);
var driver=createObject("component", drivernames[ arguments.type ]);
// var custom=structNew();
loop collection="#arguments#" item="local.key"{
if( key != "custom" && findNoCase("custom",key) EQ 1){
local.l=len(key);
arguments.custom[mid(key,7,l-7+1)]=arguments[key];
}
}
if( arguments.type == "MSSQL" ){
arguments.custom["databaseName"] = arguments.database;
}
Thanks!. That’s what I was really thinking was probably correct.
What’s the customUseLegacyDatetimeCode
do in Lucee 6?
I have a feeling that might be doing what I’m wanting, but I’m not sure based on the comment hint, which just says:
@customUseLegacyDatetimeCode Use code for DATE/TIME/DATETIME/TIMESTAMP handling in result sets and statements
it’s a mysql jdbc feature/quirk
opened 10:58AM - 24 Apr 17 UTC
closed 07:31AM - 25 Dec 17 UTC
For future discussion about `embulk-input-mysql`.
It seems better to set `useLe… gacyDatetimeCode=false` by default.
For example, If server use UTC timezone, and client use 'Asia/Tokyo',
a user need to set `options: { useLegacyDatetimeCode: false }` or similar explicitly.
https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html
It's not convenient.
The following references are written in Japanese.
http://qiita.com/katsuyan/items/f22dc5a86522ba3c5652
https://gist.github.com/hiroyuki-sato/dc59e8d45778dac0e0ee417bb27d57a1
http://vividcode.hatenablog.com/entry/mysql/connector-j-5.1-use-legacy-datetime-code
FYI, I added a PR on that ticket
1 Like