Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • B Base
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • quarxConnect.de
  • Base
  • Issues
  • #2

Closed
Open
Created Dec 21, 2021 by Oliver Ohnesorge@ollyReporter

Field mapping for mySQLi query not working correctly

When creating a query with a field type of text, the mapping breaks. It tries to find an index in the var $fieldType, wich is just overwritten with none existing index.

          case Base\Field::TYPE_TEXT:
            if ((($fieldLength = $tableField->getMaxSize ()) <= 255) && ($fieldLength !== null))
              $fieldType = 'TINY';
            elseif ($fieldLength <= 65535)
              $fieldType = '';
            elseif ($fieldLength <= 16777215)
              $fieldType = 'MEDIUM';
            else
              $fieldType = 'LONG';
            
            $fieldType .= $typeMap [$fieldType];
            
            # On Text: [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name]
            
            break;

https://gitlab.quarxconnect.de/quarxconnect.de/qcBase/-/blob/main/src/Catalog/mySQLi.php#L358

As the new values are prefixes something like this might to the trick:

          case Base\Field::TYPE_TEXT:
            if ((($fieldLength = $tableField->getMaxSize ()) <= 255) && ($fieldLength !== null))
              $fieldTypePreFix = 'TINY';
            elseif ($fieldLength <= 65535)
              $fieldTypePreFix = '';
            elseif ($fieldLength <= 16777215)
              $fieldTypePreFix = 'MEDIUM';
            else
              $fieldTypePreFix = 'LONG';
            
            $fieldType = $fieldTypePreFix . $typeMap [$fieldType];
            
            # On Text: [BINARY] [CHARACTER SET charset_name] [COLLATE collation_name]
            
            break;
Assignee
Assign to
Time tracking