我不知道你怎么能要求改进。 PHP4完成了。你不能改变历史。你是否希望他们重写PHP4并重新发布它以便用PHP5更好地工作?或者您是否期望PHP5的新版本实现差的,低效的PHP4对象处理?只是为了便携性? 我希望的是PHP 5中没有那么多碎片br /> it - PHP 6被迫向后破解兼容性。 - __________ | im | yler http://timtyler.org/ ti*@tt1lock.org 取消锁定以回复。 那是因为你还没有真正看过PHP的现有数据库 abastraction包。 如果你想要便携性,你可能想看看Metabase。不仅如此,提供了编写应用程序的方法,无需更改单个 行以适应不同的数据库,但它也提供便携式 意味着定义和安装数据库模式。 您需要做的就是定义表,字段, 索引和序列的数据库模式。简单的XML格式和Metabase架构管理器 类将为你安装它。 现在,真正美妙的是,如果你想要收集你的/> 数据库模式,您只需要更改XML模式定义和 元数据库模式管理器将确定更改的内容并执行必要的更改而不执行必要的更改在第一次 时间安装架构或最后一次更新后,干扰已经插入数据库的数据。 这是我在Java世界中尚未看到的东西。 Metabase API还提供其他便携式功能,这对于Web开发非常重要,如序列仿真(数据库 主键字段的独立自动递增值)和(之前) 查询结果范围行限制(如MySQL LIMIT但在数据库中 独立方式)。 (BTW,你是否知道PHP作者Rasmus Lerdorf发明了用于mini-SQL的LIMIT子句的概念,后来被 MySQL和其他人采用了。 当Metabase开始在1998年底开发时,这些便携式功能非常具有创新性。大多数其他PHP数据库抽象 包具有复制Metabase。我知道 最新的JDBC版本有一些进展,但是AFAIK似乎在数据库的范围和实用性方面仍然有一些问题可以实现。可移植性 功能,特别是对Web应用程序感兴趣。 元数据库是开源的,可在此处获取: http://www.phpclasses.org/metabase - 问候, Manuel Lemos PHP类 - 免费准备使用写入的OOP组件PHP http://www.phpclasses.org/ PHP评论 - PHP书籍和其他产品的评论 http://www.phpclasses.org/reviews/ Metastorage - 数据对象关系映射层生成器 http://www.meta-language.net/metastorage.html I just ported one of the apps I wrote using PHP 5 under Windows toPHP 4 under unix.I knew I wanted to deploy in this environment - and wrote my code inanticipation of running in the other environment.A brief summary follows:Portability was not too bad. However there were several problems I didnot anticipate.One was that MySQL behaved completely differently. It didn''t likethe quotes I used. It objected to several simple SQL statements thatI was amazed to find weren''t as portable as I had hoped. SQL portabilityeven between different versions of MySQL seems poorer than I had expectedit would be.I also had two PHP language problems.One was that integers I had used as unique IDs in database fieldsstarted showing up as "1.556564658E18" under unix - and then theyfailed to match against the contents of the database they had comefrom. The same code worked on PHP 5 under Windows.The other problem was a mysterious problem involving recursion.I passed an object recursively to a function - and PHP 4 underunix behaved very badly - apparently making a copy of the object -or misbehaving in a very poor fashion. I had to extract theobject from the call chain and put it into a class variablebefore things started working again.As a brief summary: SQL portability between these environmentswas apalling - worse than I had expected. PHP portability wasnot very good. Significantly worse than something like Java - IMO.I look forward to the portability situation improving - it seemsas though there is significant scope for improvement.--__________|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply. 解决方案I don''t see how you can ask for improvement. PHP4 is done. You can''tchange history. Do you expect them to rewrite PHP4 and re-release it towork better with PHP5? Or do you expect a new version of PHP5 whichimplements poor, inefficient PHP4-like object handling? Just forportability''s sake?In either case, one or both of your servers will require upgrading. Soif you have to upgrade anyway, might as well make them both PHP5.--cd I don''t see how you can ask for improvement. PHP4 is done. You can''t change history. Do you expect them to rewrite PHP4 and re-release it to work better with PHP5? Or do you expect a new version of PHP5 which implements poor, inefficient PHP4-like object handling? Just for portability''s sake?What I''m hoping for is that PHP 5 doesn''t have so many broken bits init - which PHP 6 is forced to break backwards compatibility to fix.--__________|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.That is because you have not really looked at the existing databaseabastraction packages for PHP.If you want portability, you may want to look at Metabase. Not only itprovides means to write applications without needing to change a singleline to adapt to different databases, but it also provides portablemeans to define and install your database schema.All you need to do is to define your database schema of tables, fields,indexes and sequences in a simple XML format and Metabase schema managerclasses will install it for you.Now, what is really wonderful is that if you want to chenage yourdatabase schema, you just need to change the XML schema definition andMetabase schema manager will figure what were the changes and performthe necessary alterations without disturbing the data that was alreadyinserted in the database after the schema was installed for the firsttime or updated for the last time.This is something that I have yet to see in the Java world.Metabase API also offers other portable features that are veryimportant for Web development like sequence emulation (databaseindependent auto-incremented values for primary key fields) and (before)query result range row limit (like MySQL LIMIT but in databaseindependent way).(BTW, did you know that it was PHP author Rasmus Lerdorf that inventedthe concept of the LIMIT clause for mini-SQL that was later adopted byMySQL and others).These portable features were so innovating when Metabase was started tobe developed in late 1998 that most other PHP database abstractionpackages have copied Metabase. I know there was some progress in thelatest JDBC releases, but AFAIK it seems that JDBC has still some catchup to do in terms of the reach and utility of database portabilityfeatures, especially of interest for Web applications.Metabase is Open Source is available here: http://www.phpclasses.org/metabase--Regards,Manuel LemosPHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html 这篇关于PHP和SQL可移植性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 22:03