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

MSSQL - Driver does not support setting attributes (SQLSTATE[IM001]) #348

Open
kinekt4 opened this issue Jul 24, 2015 · 4 comments
Open

Comments

@kinekt4
Copy link

kinekt4 commented Jul 24, 2015

When making a connection to a MS SQL Server from Symfony2:

$con = Propel::getConnection('default');

I get the following error:

SQLSTATE[IM001]: Driver does not support this function: driver does not support setting attributes 

This happens when trying to set the following:

// app/config/config.yml
propel:
    database:
        connections:
            default:
              ...
              attributes:
                  ATTR_EMULATE_PREPARES:  true

However, even when this is removed, the error still persists because the DependencyInjector adds in a default:

// Propel\PropelBundle\DependencyInjection\Configuration
->arrayNode('attributes')
  ->addDefaultsIfNotSet()
    ->children()
        ->booleanNode('ATTR_EMULATE_PREPARES')->defaultFalse()->end()
    ->end()
->end()

If I remove like so, it works:

->arrayNode('attributes')
  ->addDefaultsIfNotSet()
->end()

Question: I wonder if the adapter should be checked before adding the default attribute ('ATTR_EMULATE_PREPARES) ?

Stack Trace

in vendor/propel/propel/src/Propel/Runtime/Connection/PdoConnection.php at line 76  -

        $attribute = constant($attribute);
    }
    return parent::setAttribute($attribute, $value);
}

adapter: mssql
driver: pdo_dblib
framework: symfony2
propel version: 2.0.0-dev

@havvg
Copy link
Member

havvg commented Jul 24, 2015

You can overwrite the attributes, by setting an empty array (or any other list), as this is what you want.

propel:
    database:
        connections:
            default:
              ...
              attributes: []

@kinekt4
Copy link
Author

kinekt4 commented Jul 30, 2015

I believe I tried this already and the DependencyInjector detects that the array is empty and goes ahead and adds the children. Let me confirm.

@kinekt4
Copy link
Author

kinekt4 commented Sep 17, 2015

Can confirm that setting an empty array does not help.

@havvg havvg added this to the 2.0.0-alpha5 milestone Jan 22, 2016
@kinekt4 kinekt4 changed the title Driver does not support setting attributes (SQLSTATE[IM001]) MSSQL - Driver does not support setting attributes (SQLSTATE[IM001]) Sep 22, 2017
@Ismgh
Copy link

Ismgh commented Jun 16, 2019

don't use set attribut use array in pdo from the begining

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

No branches or pull requests

3 participants