Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown type in sqlsrv_buffered_query::sqlsrv_buffered_query When querying extended properties #1079

Closed
Beakerboy opened this issue Jan 17, 2020 · 8 comments
Labels

Comments

@Beakerboy
Copy link

Beakerboy commented Jan 17, 2020

EXEC sp_addextendedproperty @name=N'MS_Description', @value='Schema table description may contain "quotes" and could be long—very long indeed.',@level0type = N'Schema', @level0name = 'dbo',@level1type = N'Table', @level1name = 'test48992550test_table'

SELECT prop.value FROM information_schema.tables tbl LEFT JOIN sys.extended_properties prop ON prop.major_id = object_id(tbl.table_schema + '.' + tbl.table_name) AND prop.minor_id = 0 AND prop.name = 'MS_Description' WHERE tbl.table_type = 'base table' AND tbl.table_schema='dbo' AND tbl.table_name='test48992550test_table'

Produces the error:
Drupal\KernelTests\Core\Database\SchemaTest::testSchema PHPUnit\Framework\Exception: PHP Fatal error: Unknown type in sqlsrv_buffered_query::sqlsrv_buffered_query in /home/travis/build/Beakerboy/drupal-project/web/drivers/lib/Drupal/Driver/Database/sqlsrv/Statement.php on line 67

PHP Driver version or file name
sqlsrv-5.6.1
pdo_sqlsrv-5.6.1

SQL Server version
mssql-server-2019 xenial

Client operating system
Ubuntu

PHP version
7.2.15

@yitam
Copy link
Contributor

yitam commented Jan 17, 2020

/home/travis/build/Beakerboy/drupal-project/web/drivers/lib/Drupal/Driver/Database/sqlsrv/Statement.php on line 67

hi @Beakerboy please provide few lines before and after this line 67

@Beakerboy
Copy link
Author

Beakerboy commented Jan 17, 2020

Wow! Such fast response. Line 67 is the last in this block.

public function execute($args = [], $options = []) {
if (isset($options['fetch'])) {
  if (is_string($options['fetch'])) {
    // Default to an object. Note: db fields will be added to the object
    // before the constructor is run. If you need to assign fields after
    // the constructor is run, see http://drupal.org/node/315092.
    $this->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
  }
  else {
    $this->setFetchMode($options['fetch']);
  }
}
$logger = $this->dbh->getLogger();
$query_start = microtime(TRUE);

// If parameteres have already been binded
// to the statement and we pass an empty array here
// we will get a PDO Exception.
if (empty($args)) {
  $args = NULL;
}

// Execute the query. Bypass parent override
// and directly call PDOStatement implementation.
$return = PDOStatement::execute($args);

Full file is here(https://github.com/Beakerboy/sqlsrv/blob/Funky-default/drivers/lib/Drupal/Driver/Database/sqlsrv/Statement.php)

I’m working on the sqlsrv driver for Drupal, trying to get it to pass all the Core Integration tests. The current driver just skips over all schema description functionality, (possibly because of this issue?)

@Beakerboy
Copy link
Author

Beakerboy commented Jan 17, 2020

The repository linked above has both an Appveyor (Windows/PHP/IIS) and Travis (Ubuntu/PHP/Apache) Script to install Drupal And run test suites. The error occurs on both.

@yitam
Copy link
Contributor

yitam commented Jan 17, 2020

Thanks for the info @Beakerboy
We will do the investigation and get back to you on this.

@yitam
Copy link
Contributor

yitam commented Jan 17, 2020

At first glance, I can't seem to find sqlsrv_buffered_query::sqlsrv_buffered_query... am I missing something?

@Beakerboy
Copy link
Author

Beakerboy commented Jan 18, 2020

I believe the sqlsrv_buffered_query data type is being returned by PDO. Might be similar to this:
#51
@david-garcia-garcia is the original maintainer of the Drupal module I’m working on.

@yitam
Copy link
Contributor

yitam commented Jan 20, 2020

Thanks @Beakerboy I can reproduce the issue in #51 with buffered queries. I'll investigate further and get back to you.

@Beakerboy
Copy link
Author

Fixed! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants