test-fullautomation / robotframework-robotlog2db

2 stars 1 forks source link

String length check for database entries #32

Closed HolQue closed 1 year ago

HolQue commented 1 year ago

While testing I got the following error:

FATAL ERROR: Provided value 'RobotFramework Testsuites' for 'project' is longer than acceptable 20 chars.
D:/RobotFramework/python39/Lib/site-packages/RobotLog2DB/robotlog2db.py has been stopped!

Here I have doubts. Why does RobotLog2DB check the string length? The type and the size of database table entries are usually checked by the database itself. If a database client exceeds any limit while writing, the database returns an error.

RobotLog2DB defines a big list of string lenghts: DB_STR_FIELD_MAXLENGTH. These string lenghts are now defined at two positions: within the app and within the database - and therefore must be maintained twice. This should not be necessary.

test-fullautomation commented 1 year ago

As discussed we allow on database level names up to 100 char. On WebApp level we need to map project/variant to a shorter name. *log2db* tools nee do be adapter accordingly.

test-fullautomation commented 1 year ago

Hi Ngoan, what is the function of DB_STR_FIELD_MAXLENGTH? As per my understanding this is all defined on database level and in case of violations the mysql-client will raise a good exception? So this would be redundant and difficult to maintain code? Thank you, Thomas

ngoan1608 commented 1 year ago

Hi Thomas,

The definition DB_STR_FIELD_MAXLENGTH is used for 2 purposes:

In previous implementations, the numbers are used for truncating without any meanings. So I collected all of them and define as DB_STR_FIELD_MAXLENGTH to make they are meaningful and easy to maintain.

There are many definitions in side it but just some of them are used but I defined all imported information in case they are used in future (if we define the mapped information and it requires string truncation). => For sure we can remove the definitions that are not used now.

Thank you, Ngoan

HolQue commented 1 year ago

"Truncate"???? What is this?

Let's assume: MAXLEN = 5 DB app gets "testname_1" and "testname_1" and sends two times "testn..."? Really?

This would cause ambiguities. I cannot believe that we make it so much easy to run into troubles.

In my opinion the DB apps should not be allowed to do any modification of the transported values.

HolQue commented 1 year ago

If truncation, then in web app, but not in database!

test-fullautomation commented 1 year ago

Hi Ngoan, which with pull-request is this solved? thank you, Thomas

ngoan1608 commented 1 year ago

Hi Thomas,

This issue has been fixed in merged request #41 . This ticket can be closed now.

Thank you, Ngoan

test-fullautomation commented 1 year ago

solved and merged with #41