statementwrapper have no range

Created on 12 August 2023, over 1 year ago
Updated 13 September 2024, 3 months ago

Problem/Motivation

I run a D9.5.10 in linux with a MSSQL as Drupal database using the sqlsrv driver.
I also use the ip2country module which originally uses the LIMIT setting so for that i created a patch
making it use
->range(0,1) instead
https://www.drupal.org/project/ip2country/issues/3368606 πŸ› Fails in MSSql due to limit, must use Range on object Fixed

Now weeks of wounderful site it fails as it turns out that
core/lib/Drupal/Core/Database/StatementWrapper.php ,Lines 98-103

  public function __call($method, $arguments) {
    if (is_callable([$this->getClientStatement(), $method])) {
      @trigger_error("StatementWrapper::{$method} should not be called in drupal:9.1.0 and will error in drupal:10.0.0. Access the clie>
      return call_user_func_array([$this->getClientStatement(), $method], $arguments);
    }
    throw new \BadMethodCallException($method);
  }

Is looking for the range function, and that does not exists and therefore it fails.
As this is deprechiated in later versions i found out that if i add

  public function range($start = NULL, $length = NULL) {
    $this->range = func_num_args() ? array(
      'start' => $start,
      'length' => $length,
    ) : array();
    return $this;
  }

It starts to work again.
I dont know why, how what, where this is best to be adressed, so ill adress it here, hoping for clearance and help.
Ill also provide a patch

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: works as designed

Version

11.0 πŸ”₯

Component
DatabaseΒ  β†’

Last updated 2 days ago

  • Maintained by
  • πŸ‡³πŸ‡±Netherlands @daffie
Created by

πŸ‡ΈπŸ‡ͺSweden arne_hortell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024