Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-38525

SQLService puts strings into preparedstatements as bytes

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 11.5 [Tentative], 12.0, 19.0
    • Fix Version/s: 12.0, 19.0
    • Component/s: Kernel
    • Labels:
    • 12 status:
      Resolved
    • Previous Issue Keys:
      KNL-1550
    • Test Plan:
      Hide

      It was commented that this might only have a side effect on Oracle so that should be tested.

      Test on Trunk/Master on Oracle server (only affects Oracle)
      Go to some tool, add over 4000 characters to a text WYSIWYG text box, save
      If it saves this seems like it's good.

      It would be obvious if there are any problems caused by this but should be no noticeable side affects.

      Show
      It was commented that this might only have a side effect on Oracle so that should be tested. Test on Trunk/Master on Oracle server (only affects Oracle) Go to some tool, add over 4000 characters to a text WYSIWYG text box, save If it saves this seems like it's good. It would be obvious if there are any problems caused by this but should be no noticeable side affects.

      Description

      This affects every version of Sakai, but it looks like BasicSqlService has this method prepareStatement that has special cases for some datatypes but doesn't have any for string. And in the else case, it does a toString() and does a setBytes.

      This issue came up as I was trying to see why the p6spy library was hex encoding our string outputs. https://github.com/p6spy/p6spy/issues/409

      Adding an instanceof String case fixes the problem I'm seeing with p6spy and everything else works fine. I don't know about this else case though.

      				// %%% support any other types specially?
      				else
      				{
      					String value = fields[i].toString();
      					sqlServiceSql.setBytes(pstmt, value, pos);
      					pos++;
      				}
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jonespm Matthew Jones
                  Reporter:
                  jonespm Matthew Jones
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code