sql-server - 列 ""在 Propel 2 的表 "status"中声明了两次

标签 sql-server propel

我正在尝试使用 Propel 2 从 MSSQL 数据库反向生成架构。我已经像往常一样设置了 YAML 配置文件:

dbname:
    adapter: mssql
    classname: Propel\Runtime\Connection\ConnectionWrapper
    dsn: "dblib:host=123.456.789.012;dbname=dbname"
    user: username
    password: password
    attributes:

当我运行命令 propel reverse 'dbname' 时,我收到错误:

[Propel\Generator\Exception\EngineException]
Column "" declared twice in table "Status"

这显然是抛出在这里: 奥 git _a @r499

为什么 Propel 尝试添加“空”列?当我查看数据库表Status的设计时,我的SQL Server Management Studio根本不显示空列,它只显示它包含的两列(uid名称)。

编辑: 于是我深入研究了Propel的代码,发现这里似乎出了问题: https://github.com/propelorm/Propel2/blob/master/src/Propel/Generator/Model/Table.php#L499

 protected function addColumns(Table $table)
    {
        $dataFetcher = $this->dbh->query("sp_columns '" . $table->getName() . "'");
        foreach ($dataFetcher as $row) {
            $name = $this->cleanDelimitedIdentifiers($row['COLUMN_NAME']);

$table->getName() 正确返回正确的表名称。当我打印 dataFetcher 时,它是一个 PDO 对象。然而: $row 给出以下数组:

Array(
    [0] => My DBname
    [1] => My DBprefix
    [2] => Status
    [3] => uid
    [4] => 4
    [5] => int identity
    etc. no string indices hence COLUMN_NAME is empty.

最佳答案

(代表 OP 发布):

这是 Propel MSSQL 模式解析器中的一个错误:https://github.com/propelorm/Propel2/issues/863 .

关于sql-server - 列 ""在 Propel 2 的表 "status"中声明了两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27985791/

相关文章:

php - Doctrine 与 Propel 有很好的比较吗?

php - SQL 数据库是否返回类型,或者数据库抽象层是否执行隐式转换? (推进和 PHP)

c# - 为什么使用 SqlCommand 插入语句很慢?

SQL Server 2008 将 1 列拆分为 3 列(运输维度)

php - 从日期中提取月份

php - 填充对象时重写 Propel 1.6 构造函数会引发警告

sql - 如何解决 SQL Server 中的性能问题

sql-server - 使用下划线对数据进行全文搜索

sql - 解决两个表之间的排序规则问题

php - 无法让外键在 Propel2 中工作