Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Late database connection #19

Closed
wants to merge 1 commit into from
Closed

Conversation

guiled
Copy link
Member

@guiled guiled commented Oct 25, 2014

Open the connection the later we can (not at the Dal construction, but at the first connection need).

It may makes some BC break if user test the connection result on construction.

But I think it is a good practice

  • The connection is not opened when a script doesn't need it
  • The database resource is less occupied by script using late connection

NB: please consider this PR after #17 as I included the main commit about PHP5.4 migration

@guiled guiled changed the title Lateconn Late database connection Oct 25, 2014
@Metalaka
Copy link
Member

I like the idea.
But can we use dnew on line 147-148 ?

    $connection = dnew('\Pdo', $this->parameters);

With that we can remove constants and join constructor parameters with func_get_args().

@guiled
Copy link
Member Author

guiled commented Oct 27, 2014

You are absolutely right!

@guiled guiled force-pushed the lateconn branch 3 times, most recently from 45540dc to a065588 Compare October 27, 2014 12:48
@guiled
Copy link
Member Author

guiled commented Oct 27, 2014

Didn't test it. Can you read it for me please?

@Metalaka
Copy link
Member

I've checked out your branch into my Hoa\database tests, they seem work.

@Hywan
Copy link
Member

Hywan commented Nov 3, 2014

I am assigning @osaris on this PR :-).

@Hywan
Copy link
Member

Hywan commented Nov 3, 2014

👍 for the idea also!

@osaris
Copy link
Member

osaris commented Nov 3, 2014

+1 for the idea, I'll check this PR when #17 is merged for a better readability. Thx.

@Hywan
Copy link
Member

Hywan commented Nov 12, 2014

PR #17 has been merged. ping then?

@osaris
Copy link
Member

osaris commented Nov 12, 2014

ping @guiled can you please rebase your PR ? Thx !

@guiled
Copy link
Member Author

guiled commented Nov 12, 2014

OK @osaris job's done!

@osaris
Copy link
Member

osaris commented Nov 12, 2014

Good job, the concept is ok, the code looks good but I ask @Hywan for a code review mainly for Hoa guidelines (indentation, const/var names etc). Thanks.


$connection = null;
$this->parameters = [
self::DSN => $dsn,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix alignment.

@Hywan
Copy link
Member

Hywan commented Nov 13, 2014

First, do not cache the extension_loaded result. It is better to let PHP do that by itself (or in Hoa\Core\Consistency). This is a good idea but it requires a deeper reflection I think.

Second, what do you think to extend this behavior to all the layers? A l'instar of Hoa\Stream with an open and a close methods, we can introduce the open method in Hoa\Database\Dal and update the already existing close method.

Thoughts?

@Hywan
Copy link
Member

Hywan commented Nov 24, 2014

ping?

@guiled
Copy link
Member Author

guiled commented Nov 25, 2014

I will work on it very soon : this cache will be removed...

@Metalaka
Copy link
Member

/ping

@Hywan
Copy link
Member

Hywan commented Jul 27, 2015

@guiled Ping? Are you available to work on this PR? If no, I guess someone can take over it.

@Hywan
Copy link
Member

Hywan commented Aug 14, 2015

Any volunteer to work on this PR /cc @hoaproject/hoackers?

@Hywan
Copy link
Member

Hywan commented Nov 9, 2015

ping?

@Metalaka
Copy link
Member

Metalaka commented Nov 9, 2015

I'll look it this week.

@Hywan
Copy link
Member

Hywan commented Nov 9, 2015

Perfect, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

4 participants