logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
EntropiaFox  
#1 Posted : Friday, March 15, 2019 3:39:40 PM(UTC)
EntropiaFox

Rank: Newbie

Groups: Registered
Joined: 2/20/2019(UTC)
Posts: 2
Venezuela

I've stumbled upon the following issue when using the LoadTableFromDataSource helper in order to load a table in one database from another table in a different database. The source database is SQL Server and has been defined as thus in the Connections section of the report, and the destination database is MySQL, also defined as thus in the Connections section.

However, Seal Report is casting dates as DATETIME2, a type that does not exist in MySQL, thus the generated SQL code will be invalid and the task will fail upon execution. Adding the following:

Code:
helper.DatabaseHelper.ColumnDateTimeType = "datetime";


To the template is then required in order to get things working.

Digging around in the code, from what I understand, the issue seems to be in DatabaseHelper.SetDatabaseDefaultConfiguration which has no special case for MySQL databases when handling date columns:

Code:
        public DatabaseType DatabaseType = DatabaseType.MSSQLServer;
        public void SetDatabaseDefaultConfiguration(DatabaseType type)
        {
            DatabaseType = type;
            if (type == DatabaseType.Oracle)
            {
                _defaultColumnCharType = "varchar2";
                _defaultColumnNumericType = "number(18,5)";
                _defaultColumnIntegerType = "number(12)";
                _defaultColumnDateTimeType = "date";
                _defaultInsertStartCommand = "begin";
                _defaultInsertEndCommand = "end;";
            }
            else
            {
                //Default, tested on SQLServer...
                _defaultColumnCharType = "varchar";
                _defaultColumnNumericType = "numeric(18,5)";
                _defaultColumnIntegerType = "int";
                _defaultColumnDateTimeType = "datetime2";
                _defaultInsertStartCommand = "";
                _defaultInsertEndCommand = "";
            }
        }


I'd need to set up the development environment to confirm it, but if it's truly the case I can submit a pull request to handle better defaults for other databases.
epf  
#2 Posted : Friday, March 15, 2019 5:19:18 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 653
Switzerland

Thanks: 9 times
Was thanked: 111 time(s) in 108 post(s)
Yes, good remark, you can do, test and submit the pull request to handle MySQL, we will integrate that for the 5.0.
Thank you.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.