English 中文(简体)
php pdo: it possbile to have a DBMS agnostic presentation?
原标题:php pdo: it it possbile to have a DBMS agnostic describe table ?

我有一本书,对数据库进行细分,并创建网站,以配合这一系统。 (zend-db-model-generator). 是否有办法在营地内配备一个DBMS的先天指挥系统,以便处理每一类垃圾,然后返回表结构?

因此,如果一度使用假车司机,一度使用假车,一度使用后方车,则该车将回到桌椅结构。

唯一的解决办法是获得b类,转而使用每桶制,执行适当的指挥。

最佳回答

在我能够告诉......的情况下,采用同样的格言似乎是不可能的。


About your idea of going through the database to extract informations about each table to generate some PHP classes, that s one of the things that Doctrine (the most famous PHP ORM) does.

如果您下载,并查看Doctrine/Import/[DatabaseType].php的课堂,请看一下每一类数据库的情况。

例如,MySQL在中使用以下编码。 Doctrine_Import_Mysql :

 listTableFields  =>  DESCRIBE %s ,

另一方面,关于邮政总局,请在<条码>上填写以下表格:

 listTableColumns      => "SELECT
                            a.attnum,
                            a.attname AS field,
                            t.typname AS type,
                            format_type(a.atttypid, a.atttypmod) AS complete_type,
                            a.attnotnull AS isnotnull,
                            (SELECT  t 
                              FROM pg_index
                              WHERE c.oid = pg_index.indrelid
                              AND a.attnum = ANY (pg_index.indkey)
                              AND pg_index.indisprimary =  t 
                            ) AS pri,
                            (SELECT pg_attrdef.adsrc
                              FROM pg_attrdef
                              WHERE c.oid = pg_attrdef.adrelid
                              AND pg_attrdef.adnum=a.attnum
                            ) AS default
                      FROM pg_attribute a, pg_class c, pg_type t
                      WHERE c.relname = %s
                            AND a.attnum > 0
                            AND a.attrelid = c.oid
                            AND a.atttypid = t.oid
                      ORDER BY a.attnum",

这并非易事,似乎^。


And, farther down each class, there is a method called listTableColumns -- which is not the same for each database type...

因此,对事物的猜测不会像你所希望的那样简单。

但是,作为副句子:也许你可以将理论用于你的项目的这一部分——可能比重新发明轮车更快;-

问题回答

暂无回答




相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签