From: Charlie S. <sm...@ld...> - 2003-09-28 21:01:00
|
In attempting a conversion to Oracle, I've noticed that some fields are = defined with NOT NULL default '' =20 Oracle won't accept a "NOT NULL" and a default value. Also the empty string '' doesn't appear to be acceptable either. The = enum type would be translated to a check constraint and added after the = table definition, as a lot of the fields appear to be defined in mysql with a enum and default value. = Oracle doesn't like a check constraint and a default value in the actual = table definition either, but works to have the check constraint defined by = itself as follows. =20 I wonder if I shouldn't leave the NOT NULL off of these field definitions = where there is also a default values. Also, it may easier to convert the = code to use oracle if there were a space in place of the empty string? Any= = opinions? =20 Ex. This would be the table definition for the designer table: drop table designer; create table designer ( username varchar2(64) default ' ', password varchar2(16) default ' ', auth varchar2(16) default 'BASIC', realm varchar2(16) default ' ', =66name varchar2(16) default NULL, lname varchar2(24) default NULL, email varchar2(64) default NULL, pdesign varchar2(7) default 'Y', pstatus varchar2(7) default 'N', pdata varchar2(7) default 'N', pall varchar2(7) default 'N', pgroup varchar2(7) default 'N', puser varchar2(7) default 'N', disabled varchar2(7) default 'N', changed varchar2(14), expiration varchar2(14) ) tablespace users storage (initial 2M next 2M); =20 -- alter table designer drop constraint designer_pdesign_ck; alter table designer add constraint designer_pdesign_ck check (pdesign in ('Y','N')); =20 -- alter table designer drop constraint designer_pstatus_ck; alter table designer add constraint designer_pstatus_ck check (pstatus in ('Y','N')); =20 -- alter table designer drop constraint designer_pdata_ck; alter table designer add constraint designer_pdata_ck check (pdata in ('Y','N')); =20 -- alter table designer drop constraint designer_pall_ck; alter table designer add constraint designer_pall_ck check (pall in ('Y','N')); =20 -- alter table designer drop constraint designer_pgroup_ck; alter table designer add constraint designer_pgroup_ck check (pgroup in ('Y','N')); =20 -- alter table designer drop constraint designer_puser_ck; alter table designer add constraint designer_puser_ck check (puser in ('Y','N')); =20 -- alter table designer drop constraint designer_disabled_ck; alter table designer add constraint designer_disabled_ck check (disabled in ('Y','N')); =20 -- alter table designer drop Primary key cascade; alter table designer add constraint designer_username_real_pk primary key (username,realm) using index; >>> Kon <ang...@ip...> 09/25/03 02:46AM >>> Guys, I think that the generic functions would be OK as it provides greater choice. Regards Kon On Thu, 2003-09-25 at 04:04, Matthew Gregg wrote: > I would prefer a PEAR solution, but something like this would be ok. >=20 > On Wed, Sep 24, 2003 at 11:59:32AM -0600, Charlie Smith wrote: > > So instead of mysql_connect or @OCIPLogon($oracleUser, $oraclePassword,= = $oracleSid); > > you could have: > >=20 > > function genDBConnect($genDBSid, $genDBUser, $genDBPassword) { > > if (DB =3D=3D 'Oracle) { > > $connected =3D @OCIPLogon($genDBUser, $genDBPassword, $genDBSid); > >=20 > > if($error =3D OCIError()) { > > die("<font color=3Dred>ERROR!! Couldn't connect to = server!</font>"); > > } > > return $connected; > > } > > else if (DB =3D=3D 'MySQL' { > > mysql_connect($genDBSid, $genDBUser, $genDBPassword) > > } > > } > >=20 > > Something like this? along with other generic functions to handle each= = of the mysql/oracle functional pieces? > >=20 > >=20 > > >>> "Matthew Gregg" <gr...@mu...> 09/24/03 10:56AM >>> > > This does sound good. But instead of porting to Oracle, a port to > > PEAR or some other "generic" database abstraction layer would be even > > better. > >=20 > > On Wed, Sep 24, 2003 at 09:38:28AM -0600, Charlie Smith wrote: > > > I'm starting a project to give us an oracle interface ie. replacing = mySQL calls with Oracle. Sounds like this could be beneficial to others, = especially you. Hope to be done by end of day today. Will let you know = if sounds good to you. > > >=20 > > > >>> "Stefan Champailler" <sch...@ea...> 09/22/03 08:09AM = >>> > > > Dear all, > > >=20 > > >=20 > > > I'm going to use phpESP for a project inside a big tyre company. = However, I'll=20 > > > need to interface it with Oracle through ODBC. So, what do you think = is=20 > > > better : > > >=20 > > > - use normal ODBC (iODBC, unixODBC) > > > - use PEAR libs > > >=20 > > > Personally, I prefer ODBC because I read very poor benchmarks for PEA= R= =20 > > > database access. > > >=20 > > > Any suggestions ? > > >=20 > > > Stefan > > >=20 > > >=20 > > >=20 > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf=20 > > > _______________________________________________ > > > phpESP-devel mailing list > > > php...@li...=20 > > > https://lists.sourceforge.net/lists/listinfo/phpesp-devel=20 > > >=20 > > >=20 > > >=20 > > > This message may contain confidential information, and is intended = only for the use of the individual(s) to whom it is addressed. > > >=20 > > >=20 > > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > > >=20 > > >=20 > > >=20 > > > This sf.net email is sponsored by:ThinkGeek > > > Welcome to geek heaven. > > > http://thinkgeek.com/sf=20 > > > _______________________________________________ > > > phpESP-devel mailing list > > > php...@li...=20 > > > https://lists.sourceforge.net/lists/listinfo/phpesp-devel=20 > > >=20 > >=20 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf=20 _______________________________________________ phpESP-devel mailing list php...@li...=20 https://lists.sourceforge.net/lists/listinfo/phpesp-devel=20 ---------------------------------------------------------------------------= --- This message may contain confidential information, and is intended only for= = the use of the individual(s) to whom it is addressed. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D |