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

[discussion] installation and php db connection support for postgres #584

Closed
abeck87 opened this issue Jan 31, 2015 · 7 comments
Closed

Comments

@abeck87
Copy link

abeck87 commented Jan 31, 2015

Can a installation solution for postgres be provided? Would need to provide a flag to choose between postgres and mysql db connections.

@normai
Copy link

normai commented Jan 31, 2015

I wrote a Perl script to make it multi-database capable. A php-login 2.0.1 ready made version exists on https://github.com/normai/php-login-xdb. The further not-ready work, you can inspect on http://downtown.trilo.de/svn/phplogin/trunk/PhpDbSwitch/index.html. I have not tried the Perl script against 'huge', but I expect it works there as well.

The thing is not ready in so far, as the database creation has to be done manually without instructions. And it is not scrutinized at all! I am planning to write programmatic database creation for MySQL, PostgreSQL and SQLite and possibly Oracle and MS-SQL.

But I am lazy. Try the Perl script, possibly I can help when you get stuck.

Bye, N.

@panique
Copy link
Owner

panique commented Jan 31, 2015

Hi guys,

@abeck87 Sorry, not from my side: I think expanding this to different database types is out of the scope of this script, and it would also make everything more complicated (as it's not possible to do the same things on all 3 for sure, plus the fact that the SQLlite PDO is "broken" (or at least it does work differently than the mysql PDO)). Plus, most people use mysql, so keep it as simple as possible.

@normai Excellent! Looks very good!

I'll write a big documentation about the entire project in the next months, and put in a link to this discussion here and to your code for sure, so others might find this easilsy. But let's keep the db part as simple as possible, with pure mysql for now.

Other opinions ? Feel free to comment!

@panique panique changed the title installation and php db conection support for postgres [discussion] installation and php db connection support for postgres Jan 31, 2015
@normai
Copy link

normai commented Jan 31, 2015

@panique

I'll write a big documentation ... and put in a link to this discussion here and to your code ...

Thank you. This will put me under a bit pressure to continue for a solid solution. Haha, just I am pretty resistant about pressure. Anyway, if I notice interest, it will give me motivation.

But let's keep the db part as simple as possible, with pure mysql for now.

This was the idea behind the PhpDbSwitch project: Let you work without the multi-db complications, then independently provide multi-db capability on top of your work. It was a quick experiment. Not sure whether it can ever be a solid solution, but the first results looked encouraging.

@abeck87
Copy link
Author

abeck87 commented Feb 3, 2015

Thanks for the reply. I stood up the latest huge version and attempted to migrate the existing mysql sql scripts to postgres equivalents, but no luck. When i try to login i get a "Login failed." response. I switch the db connection to use PDO pgsql "$this->database = new PDO('pgsql:". , but my schema structure must not be correct.
Andrew. Date: Sat, 31 Jan 2015 04:28:10 -0800
From: REMOVED TO BLOCK SPAMBOTS
To: REMOVED TO BLOCK SPAMBOTS
CC: REMOVED TO BLOCK SPAMBOTS
Subject: Re: [huge] installation and php db conection support for postgres (#584)

I wrote a Perl script to make it multi-database capable. A php-login 2.0.1 ready made version exists on https://github.com/normai/php-login-xdb. The further not-ready work, you can inspect on http://downtown.trilo.de/svn/phplogin/trunk/PhpDbSwitch/index.html. I have not tried the Perl script against 'huge', but I expect it works there as well.

The thing is not ready in so far, as the database creation has to be done manually without instructions. And it is not scrutinized at all! I am planning to write programmatic database creation for MySQL, PostgreSQL and SQLite and possibly Oracle and MS-SQL.

But I am lazy. Try the Perl script, possibly I can help when you get stuck.

Bye, N.


Reply to this email directly or view it on GitHub.

                  =

@normai
Copy link

normai commented Feb 3, 2015

@abeck87

... I switch the db connection to use PDO pgsql "$this->database = new PDO('pgsql:". , but my schema structure must not be correct.

The line seems to be from DatabaseFactory.php, which did not exist when I worked last time on it (in july). I saw it first time right now. I will try to catch up in the course of the week. Give me some days, then maybe I can answer more educated.

@panique DatabaseFactory - cool! In the class header, you refer to http://stackoverflow.com/questions/130878/global-or-singleton-for-database-connection. I find this thread largely in accordance with what I indicated in #585 (comment) about singleton.

What I find most interesting in this thread is the comment by user1093284 at http://stackoverflow.com/posts/8482925/revisions. He/she calls a singleton 'not really OOP', and recommends Dependency Injection instead (http://symfony.com/components/DependencyInjection).

Yes, for a deep understanding of the db connecting options, also DI has to be taken into account. But for my humble understanding, this is out of reach for you current state of the project, and would be overkill anyway. Just I like to philosophize about.

@normai
Copy link

normai commented Feb 3, 2015

@abeck87

Give me some days, then maybe I can answer more educated.

Huge forces me to update PHP .. forces update Apache, XDebug ... then possibly Perl, Python, WSGI, etc., each very carefully. BTW my environment is http://downtown.trilo.de/apps.html :)

Give me even more days.

@panique
Copy link
Owner

panique commented Feb 21, 2015

@abeck87 Hey, I think that this is out of scope of the script, and you can easily add postgres support witha few lines of code. If we start with that, then others will requests noSQL / mongoDB etc too and things get overcomplicated. As mysql fits for 99% of the users it might be better to keep it supersimple.

@panique panique closed this as completed Feb 21, 2015
@ghost ghost mentioned this issue Feb 25, 2019
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

3 participants