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

named conections are deprecated #161

Closed
peacemaster opened this issue Jan 26, 2015 · 6 comments
Closed

named conections are deprecated #161

peacemaster opened this issue Jan 26, 2015 · 6 comments

Comments

@peacemaster
Copy link

Why you refused named conections?

Are there any alternative ways to use them?

@dg
Copy link
Owner

dg commented Jan 26, 2015

How are you using them?

@peacemaster
Copy link
Author

I connect to more then one database, and using this connections in the code

dibi::connect(array('driver'   => 'mssql', 'host'     => 'localhost1', 'username' => 'root', 'password' => 'pass'), 'mssql_db_local');
dibi::connect(array('driver'   => 'mysql', 'host'     => 'localhost2', 'username' => 'root', 'password' => 'pass'), 'mysql_db_main');

$main_db = dibi::getConnection( 'mysql_db_main' );

@fprochazka
Copy link
Contributor

Isn't this better?

$localDb = new \DibiConnection(array(
    'driver' => 'mssql',
    'host' => 'localhost1',
    'username' => 'root',
    'password' => 'pass'
));

$mainDb = new \DibiConnection(array(
    'driver' => 'mssql',
    'host' => 'localhost2',
    'username' => 'root',
    'password' => 'pass'
));

@dg
Copy link
Owner

dg commented Jan 27, 2015

To create more connection and to use getConnection() is (relatively) OK, it can be reverted. Problematic is activate().

@JanRossler
Copy link
Contributor

+1 I'd also like to keep the ability to create more connections and access them with getConnection($name).

@vojtech-dobes
Copy link

"The feature isn't there and it's not gonna be there." :) No really, creating more instances doesn't make DibiConnection also a registry of its own kind, which is much cleaner architecture.

@dg dg closed this as completed in 38aa393 Feb 25, 2015
jasir added a commit to jasir/dibi that referenced this issue Mar 2, 2015
* master: (37 commits)
  Released version 2.3.1
  removed version.txt
  dibi: named connections are allowed [Closes dg#161]
  Dibi: Dump now recognize MsSql2012 offset as keyword
  DibiPdoDriver: added support for MsSql2012 Offset
  Tracy\Panel: added vector icon
  added contributing.md
  Released version 2.3.0
  Postgre: added test for matching by %like
  Postgre: fixed %like escaping [Closes dg#159]
  Dibi: $defaultDriver changed to mysqli [Closes dg#156]
  Released 2.3.0-RC1
  removed bridge for Nette 2.0 (BC break)
  dibi: named connections and activate() are deprecated (BC break)
  DibiFluent: add `leftJoin` and `on` to phpdoc.
  DibiFirePhpLogger: save some header operations for sites with hundreds of sql queries.
  DibiFirePhpLogger: Allow user defined size of json stream chunks [Closes dg#148]
  DibiTranslator: respect %if blocks for %lmt and %ofs as well [Closes dg#145][Closes dg#87]
  DibiResult: float detection locale fix [Closes dg#154]
  DibiMySqliDriver.php: fixes for HHVM
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants