Bug 133510 - Time data (not time stamp) does not work properly.
Summary: Time data (not time stamp) does not work properly.
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: dataLoss
Depends on:
Blocks:
 
Reported: 2020-05-30 06:28 UTC by Cecil Carpenter
Modified: 2021-04-15 03:44 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Base form for Tracks data nd MySQL queries of the same data. (1.30 MB, application/zip)
2020-05-30 06:28 UTC, Cecil Carpenter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cecil Carpenter 2020-05-30 06:28:17 UTC
Created attachment 161418 [details]
Base form for Tracks data nd MySQL queries of the same data.

When you have a series of time data of the form HH:MM:SS, Base does not display the data correctly.

Specific case:

I have a set of records from a music data base that are in a table named tracks.  The tracks rows contain time fields labeled "start_time and "length.  These two fields are defined as data type time and contain times in the form HH:MM:SS.  The Base form in which these values are entered is shown below.  Clearly, the values shown in the length field are incorrect.  The format is 13:47:46.  The actually data in a MySQL database that holds the data. A query of that particular set of tracks shows the data correctly.  I also have queries of the MySQL data of the same data that shows the data correctly.  Additionally, if I enter a new set of tracks for another record/CD, the data shows as being enter correctly, but the MySQL query shows the data as having been shifted to the left.  So the ones that are correct on an SQL query were entered from a 5.x version of Base.  The one shown in the submitted images with the shifted data on the SQL query was entered under a 6.x version of Base.
Comment 1 Cecil Carpenter 2020-06-10 19:39:50 UTC
I uploaded a zip files of 4 screenshots showing the issue.  I could not find a way to upload four separate screenshots.
Comment 2 Cecil Carpenter 2020-06-13 19:37:02 UTC
See this link for description and screenshots:
https://ask.libreoffice.org/en/question/246814/lo-base-has-changed-how-it-ses-time-fields/?answer=246853#post-id-246853
Comment 3 Cecil Carpenter 2020-06-28 04:47:01 UTC
How to make Base fail with Time field in a MySQL DB.

(1) Create a table column of type Time in an MySQL table with format HH:MM:SS.
(2) Create a stored procedure that totals the time for all the rows that have time date entered.
(3) Create a Base form for this MySQL table.
(4) In the Base Form, choose Column for the Time column.
(5) The only option that includes the 3 elements of time (HH:MM:SS) is 13:45:00.
(6) Choose 13:45:00.
(7)  Enter data in a number of rows where the the hours a zero, the minutes are less than 60, and the seconds are also less than 60.
(8) Execute the stored procedure that calculates the total time.
(9) The results calculated are incorrect because the time is being shifted as well as being calculated incorrectly.
Comment 4 Alex Thurgood 2020-06-29 08:02:46 UTC
@Cecil :

We need more info, I'm afraid :

- MySQL server info ;

- how do you connect from LO to the MySQL database instance ?

- if you are not using the integrated native mysql connector, please state :

- type of driver (JDBC/ODBC);
- driver version info;

- if JDBC, driver specific connection string for the JDBC classloader;
- if JDBC, the URL connection string;

- any Advanced Property settings that you might have activated/deactivated.

It would also greatly help us if you could provide a minimalist reproduction example with which to test, for example, providing an ODB file with form, and a DDL to create the database and corresponding table in mysql. 

Setting NEEDINFO
Comment 5 Alex Thurgood 2020-06-29 08:35:45 UTC
The constant is defined in 

https://opengrok.libreoffice.org/xref/core/offapi/com/sun/star/sdbc/DataType.idl?r=19c4d8d2

Reading the API documentation :
 
https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1text_1_1textfield_1_1DateTime.html

would seem to indicate that com::sun::star::util::DateTime, which links to 
com::sun::star::text::TextField

is supposed to use IsDate to decide whether a date format or a time format is supposed to be used. However, according to the same documentation, DateTimeFormat is deprecated and is there only for components that do not support a com::sun::star::util::NumberFormatter.

So...does the problem lie in the number formatter ?
Comment 6 Cecil Carpenter 2020-06-29 20:52:16 UTC
(1) MySQL Server 5.7.30-0ubuntu0.18.04.1
(2) Connection type: MySQL (Native)
(3) No special settings

I'm not sure I can get more minimalist than what I gave except for the stored procedure code which you could execute from a terminal with a call.

So you would need two (2) Columns, one to contain the values you enter and another to contain the running totals of time.  Both columns would have MySQL type of Time (HH:MM:SS)

Here's the stored procedure code:

calc_track_start_times |          | CREATE DEFINER=`butch`@`%` PROCEDURE `calc_track_start_times`(in start_volno int, in end_volno int)
Block1: begin
	declare volno, discno, sideno, trackno int;
	declare cur_volno, cur_discno, cur_side, cur_trackno int;
	declare cur_trackstarttime, cur_tracklen, next_ts_time, time_zero time;
	declare no_more_rows boolean;
	declare no_more_vols boolean;
	declare no_query_result boolean;
	declare c1 cursor for select volume_id, disc_no, side, track_no, track_start_time, track_length from track;

	declare continue handler for not found
		set no_more_rows := TRUE;
        set no_more_rows := FALSE;
        set no_more_vols := FALSE;
	set volno := start_volno;
	set discno := 1;
	set sideno := 1;
	set trackno := 1;
        set time_zero := '00:00:00';
	open c1;
	Loop1: loop
                fetch c1 into cur_volno, cur_discno, cur_side, cur_trackno, cur_trackstarttime, cur_tracklen;
		if no_more_rows then
			close c1;
			set no_more_rows := TRUE;
			leave Loop1;
		end if;
		if no_more_vols then
			close c1;
			set no_more_vols := TRUE;
			leave Loop1;
		end if;
                if cur_volno < start_volno then
                       iterate Loop1;
                end if;
		if cur_volno > end_volno then
			close c1;
			set no_more_vols := TRUE;
			leave Loop1;
		end if;
		if cur_trackno = 1 then
			set next_ts_time := time_zero;
		end if;
		call update_track_start_time (cur_volno, cur_discno, cur_side, cur_trackno, next_ts_time);
		set next_ts_time := addtime(next_ts_time,cur_tracklen);
		
  end loop Loop1;
end Block1

You can do away with all the variables that deal with volume, disc, side, and track to simplify the test to a 2 column table.  If you prefer not to do that, you can create those columns as type integer and set the volume, disc, and side to 1 in all rows and let the track go for 1 to n where n is the number of rows you want to work with.

Optionally, I can send you a track table that I already have with  with all columns filled in except the running total.  You could then run the stored procedure against that table.


Let me know how you would like to proceed.
Comment 7 QA Administrators 2020-06-30 03:42:28 UTC Comment hidden (obsolete)
Comment 8 Cecil Carpenter 2020-06-30 04:34:29 UTC
Have you viewed the desktop images I have in the zip file?  This shows the issue quite clearly.
Comment 9 Robert Großkopf 2020-08-26 15:41:32 UTC
The stored procedure shouldn't be a problem. It is working in MySQL directly, not in Base. Base has nothing to do with the calculation: Base will only show the result it is reading from the database.

So I tried something with a minimalistic table:
3 fields, one with ID, next with title and third with duration.
All this created in Base, connected directly to MariaDB (haven't any MySQL working here).
I filled in some data and started this query:

SELECT "ID", "title", "duration", ( SELECT SEC_TO_TIME(SUM( TIME_TO_SEC( "duration" ) ) ) FROM "libretest"."TimeTest" "TimeTest" WHERE "ID" <= "a"."ID" ) "Sum_Duration_Time" FROM "libretest"."TimeTest" "a"

No problem to get the right sum of the duration for all "title". I have to change the format for the column to [HH]:MM:SS only. 

All tested with MariaDB and the direct driver from LO, LO-Version 6.4.6.2 on OpenSUSE 15.1 64bit rpm Linux.
Comment 10 Alex Thurgood 2020-09-15 06:15:12 UTC
@Cecil : please provide the Linux OS and distrib-specific version number of LibreOffice if you are using one provided by the distrib.

Please indicate whether you are using a PPA, Snap or other 3rd party provided version.

Also provide the desktop environment (DE), as there are some known DE-specific bugs.From the screenshots, it looks like some kind of Ubuntu-based desktop environment.
Comment 11 Alex Thurgood 2020-09-15 06:24:34 UTC
@Cecil : can you save the form as an independent Writer document, and then run the ODT through the validator as described in bug 131127 ?

Do you see a similar validation error message ?
Comment 12 QA Administrators 2021-03-15 04:21:42 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2021-04-15 03:44:21 UTC
Dear Cecil Carpenter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp