Ask a Question related to PHP Development, Design and Development.
-
Th3L0rD #1
MySQL to PostGres conversion
Hi,
I'm porting some php code from mysql to postgres but I canąt find
something equivalent to mysql_select_db(). I use this function to switch
from a DB on machine 1 to a db on machine 2. Is there something similar for
pg ? I'm using php 4.2.2 on a linux box
thanks
thl
Th3L0rD Guest
-
Java: MySQL DATETIME conversion errors?
I do the following in my java application: Statement s = myConnection.createStatement(); ResultSet rs = s.executeQuery("SELECT startTime FROM... -
mysql charaters conversion
Dears, Is there any simple way to convert characters from national characters to 'flat' ascii characters without using cast or convert... -
postgres vs Mysql
I need to decide on which database system to use for our company. What is the popular opinion on PostGres vs. MySql? Thanks, Santosh -
Help needed for TimeStamp conversion between MySQL and PHP
On Sun, 06 Jul 2003 19:17:58 GMT, "Steven" <xueming@comcast.net> wrote: ... -
Statement Conversion Access -> mySQL
SQL = "DELETE FROM table WHERE ID IN (1, 9, 15, 20)" The above statement is for deleting records in access using checkboxes on a form (deletes... -
Terence #2
Re: MySQL to PostGres conversion
Th3L0rD wrote:
The answer lies in examining the [xxx]_connect() functions from mysql> Hi,
> I'm porting some php code from mysql to postgres but I canąt find
> something equivalent to mysql_select_db(). I use this function to switch
> from a DB on machine 1 to a db on machine 2. Is there something similarfor
> pg ? I'm using php 4.2.2 on a linux box
>
> thanks
>
> thl
>
and pg.
You will see that the datbase name is required as part of the pg connect
string. It is not required for mysql because you choose which database
at runtime. Postgres does not allow you to change which database you are
using at runtime for the given **connection resource**.
There is also no Postgres command I am aware of that you can execute to
change databases
[url]http://www.postgresql.org/docs/current/interactive/sql-commands.html[/url]
In your previous mysql based code, on what basis do you choose to switch
databases?
Terence Guest
-
R. Rajesh Jeba Anbiah #3
Re: MySQL to PostGres conversion
Th3L0rD <th3l0rd@nospam.katamail.com> wrote in message news:<Xns943D8A5B6B0BAth3l0rdnospamkatamai@63.223. 5.254>...
Why not try [url]http://mp2p.mikekohn.net/[/url] ?> Hi,
> I'm porting some php code from mysql to postgres
---
"Dying is an art, like everything else"---Sylvia Plath
Email: rrjanbiah-at-Y!com
R. Rajesh Jeba Anbiah Guest
-
Michael Fuhr #4
Re: MySQL to PostGres conversion
[email]ng4rrjanbiah@rediffmail.com[/email] (R. Rajesh Jeba Anbiah) writes:
Or use dbx, avoid using database-specific features, and use a subset> Th3L0rD <th3l0rd@nospam.katamail.com> wrote in message news:<Xns943D8A5B6B0BAth3l0rdnospamkatamai@63.223. 5.254>...>> > Hi,
> > I'm porting some php code from mysql to postgres
> Why not try [url]http://mp2p.mikekohn.net/[/url] ?
of SQL that's likely to work everywhere. Done correctly, porting
code from one DBMS to another can involve nothing more than changing
the arguments to dbx_connect().
[url]http://www.php.net/manual/en/ref.dbx.php[/url]
With dbx you might lose functionality that the database-specific
APIs provide, but if you've ever had to work with multiple DBMSs
or if you've had to port a lot of code from one DBMS to another,
then you might appreciate having a common API.
If dbx is too lacking, then you could write your own module to
provide the functionality you want while hiding the database-specific
details from the application. To port from one DBMS to another,
you'd just change or add a little code in the module instead of
having to change code throughout the application.
--
Michael Fuhr
[url]http://www.fuhr.org/~mfuhr/[/url]
Michael Fuhr Guest
-
R. Rajesh Jeba Anbiah #5
Re: MySQL to PostGres conversion
[email]mfuhr@fuhr.org[/email] (Michael Fuhr) wrote in message news:<3fc2f398$1_4@omega.dimensional.com>...
So, it's not a wrapper and so I couldn't understand the use of dbx.> [email]ng4rrjanbiah@rediffmail.com[/email] (R. Rajesh Jeba Anbiah) writes:
>>> > Th3L0rD <th3l0rd@nospam.katamail.com> wrote in message news:<Xns943D8A5B6B0BAth3l0rdnospamkatamai@63.223. 5.254>...> >> > > Hi,
> > > I'm porting some php code from mysql to postgres
> > Why not try [url]http://mp2p.mikekohn.net/[/url] ?
> Or use dbx, avoid using database-specific features, and use a subset
> of SQL that's likely to work everywhere. Done correctly, porting
> code from one DBMS to another can involve nothing more than changing
> the arguments to dbx_connect().
If you want to move to another DB, you need to change the whole code
with some search and replace...
My knowledge is limited to native MySQL and PEAR. But, I hate PEAR
because of it's messy. Most often I would use native codes; sometimes
depending upon the project I would go for my own wrapper DB class.
I would like to know the real use of dbx. It seems that you've used
dbx successfully... that's why I've decided to ask you the __real__
benefit of dbx.
TIA
---
"Dying is an art, like everything else"---Sylvia Plath
Email: rrjanbiah-at-Y!com
R. Rajesh Jeba Anbiah Guest
-
Michael Fuhr #6
Re: MySQL to PostGres conversion
[email]ng4rrjanbiah@rediffmail.com[/email] (R. Rajesh Jeba Anbiah) writes:
If the application is already written using a database-specific> [email]mfuhr@fuhr.org[/email] (Michael Fuhr) wrote in message news:<3fc2f398$1_4@omega.dimensional.com>...>> >
> > Or use dbx, avoid using database-specific features, and use a subset
> > of SQL that's likely to work everywhere. Done correctly, porting
> > code from one DBMS to another can involve nothing more than changing
> > the arguments to dbx_connect().
> So, it's not a wrapper and so I couldn't understand the use of dbx.
> If you want to move to another DB, you need to change the whole code
> with some search and replace...
API, then yes, you have to make global substitutions when porting
to a new database.
The benefit of using dbx or any other database abstraction layer> I would like to know the real use of dbx. It seems that you've used
> dbx successfully... that's why I've decided to ask you the __real__
> benefit of dbx.
is that you change almost nothing when porting an application to
use a different DBMS: ideally you'd change only one line, the line
that connects to the database. The rest of the application doesn't
know or care whether the database is MySQL, PostgreSQL, Oracle,
Sybase, or whatever. This makes the application more portable and
easier to maintain.
The disadvantage of database abstraction layers is that you can
lose access to features that are by their nature database-specific.
The code might also be less efficient due to the overhead imposed
by the abstraction layer.
Whether the advantages of using a database abstraction layer outweigh
the disadvantages depends on the environment and your priorities.
If the code might have to use different DBMSs, and if the cost of
modifying the code and then testing the changes is expensive, then
using an abstraction layer might be preferable. On the other hand,
if the application is likely to run only in an environment that's
already heavily committed to a particular DBMS, then you might
prefer to use that DBMS's API for efficiency and to gain full access
to its features.
--
Michael Fuhr
[url]http://www.fuhr.org/~mfuhr/[/url]
Michael Fuhr Guest
-
Th3L0rD #7
Re: MySQL to PostGres conversion
> I'm porting some php code from mysql to postgres but I canąt find
thanks to all for the replies. I simply modified the function that selects> something equivalent to mysql_select_db(). I use this function to
> switch from a DB on machine 1 to a db on machine 2. Is there something
> similar for pg ? I'm using php 4.2.2 on a linux box
wich DB to use to work properly with PG (I should have read better the
manual ^__^)
thanks again
thl
Th3L0rD Guest



Reply With Quote

