Adalennis opened a new issue, #9167:
URL: https://github.com/apache/hop/issues/9167

   ### Apache Hop version?
   
   SNAPSHOT-20261021
   
   ### Java version?
   
   Java 21
   
   ### Operating system
   
   macOS
   
   ### What happened?
   
   Three bugs in ActionMssqlBulkLoad, found while documenting the action's 
result (#9143). They are described on the docs page and can be removed from it 
when fixed.
   
   **1. False with 0 errors on three checks**
   
   execute() returns `result` without `setNrErrors(1)` in three places. The 
action is false with 0 errors, and the reason is only logged as an error:
   
   - the connection is not a Microsoft SQL Server connection (line 251): 
"Target database hop is not a MSSQL Database!"
   - *Fields terminated by* is empty while *Data file type* is char or widechar 
(line 275): "Field terminator is missing!"
   - *Error file* exists while *Add date time* is unchecked (line 307): "Error 
file already exists! ..."
   
   Every other failure of the action counts 1 error. With 0 errors, a following 
"Success" action or the end of the workflow treats the run as successful.
   
   **2. Specific codepage sends 'Specific'**
   
   With *Codepage* set to Specific and *Specific codepage* set to 65001, the 
action sends:
   
       BULK INSERT t FROM '.../ms.csv' WITH 
(FIELDTERMINATOR=';',ROWTERMINATOR='0x0a',CODEPAGE = 'Specific')
   
   Lines 288–297:
   
       if (codePage.equals("Specific")) {
         String realCodePage = resolve(codePage);        // should be 
resolve(specificCodePage)
         if (specificCodePage.length() < 0) {            // never true
           ...SpecificCodePageMissing...
   
   So the value of Specific codepage is never used. Also, the check for a 
missing specific codepage can never trigger, because `length() < 0` is never 
true.
   (My test server is SQL Server for Linux, which refuses any CODEPAGE except 
RAW, so I could only check the generated SQL in the log, not a load on Windows.)
   
   **3. Start at line is ignored when End at line is set**
   
   Both options are written to the same variable (lines 335–342):
   
       if (startFile > 0) { takeFirstNbrLines = "FIRSTROW=" + startFile; }
       if (endFile > 0)   { takeFirstNbrLines = "LASTROW=" + endFile; }
   
   so with both set, FIRSTROW is lost. With a 3-line file (1;a 2;b 3;c), Start 
at line 2 and End at line 3 loaded all three rows. Start at line 2 alone loaded 
rows 2 and 3 as expected. Expected: `FIRSTROW=2,LASTROW=3`.
   
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Hop Gui


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to