문제

이 스크립트를 계속 실행하고 오류가 발생합니다.:오류 메시지가 나타납니다.;"1 줄"근처에서 사용할 수 있는 올바른 구문에 대한 설명서를 확인하십시오

그것은 빈 쿼리를 실행하려고하는 것처럼 보이지만 내 설치 스크립트를 보면 왜 그렇게 할 지 알 수 없습니다.

스크립트 설치:

<?php

Mage::log('Running Mdlogistics install script');
echo "installer running";

$installer = $this;

$installer->startSetup();

// Note that these addColumn() return the query results, rather than the 
// instance of the db connection object, so they can't be chained.
$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
    'ship_status', array(
        'type' => Varien_Db_Ddl_Table::TYPE_SMALLINT,
        'nullable' => false,
        'default' => 0,
        'comment' => 'True if this order has been shipped from the warehouse'
    ));

$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
    'edi_850_sent_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
        'nullable' => true,
        'default' => null,
        'comment' => 'Timestamp EDI 850 was sent to Highjump'
    ));

$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
    'edi_856_received_at', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null,
    array(
        'nullable' => true,
        'default' => null,
        'comment' => 'Timestamp EDI 856 was received from highjump'
    ));

$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
    'po_value', Varien_Db_Ddl_Table::TYPE_FLOAT, null,
    array(
        'nullable' => true,
        'default' => null,
        'comment' => 'Total amount sent to Binatone for this order'
    ));

// This one causes the errors, but I don't see anything wrong with it
$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
        'po_currency', Varien_Db_Ddl_Table::TYPE_VARCHAR, null,
        array(
            'nullable' => true,
            'default' => null,
            'comment' => 'Currency used for this order'
        ));


$installer->getConnection()
    ->addColumn($installer->getTable('sales/order'),
        'creditcard_fee', Varien_Db_Ddl_Table::TYPE_FLOAT, null,
        array(
            'nullable' => true,
            'default' => null,
            'comment' => 'Credit card expense for this order'
        )
    );

$installer->endSetup();

그것이 만드는 오류:

설치 프로그램 실행 중

PDOException Object
(
[message:protected] => SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
[string:Exception:private] =>
[code:protected] => 42000
[file:protected] => /var/www/html/lib/Zend/Db/Statement/Pdo.php
[line:protected] => 228
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /var/www/html/lib/Zend/Db/Statement/Pdo.php
[line] => 228
[function] => execute
[class] => PDOStatement
[type] => ->
[args] => Array
(
[0] => Array
(
)

)

)

[1] => Array
(
[file] => /var/www/html/lib/Varien/Db/Statement/Pdo/Mysql.php
[line] => 110
[function] => _execute
[class] => Zend_Db_Statement_Pdo
[type] => ->
[args] => Array
(
[0] => Array
(
)

)

)

[2] => Array
(
[file] => /var/www/html/app/code/core/Zend/Db/Statement.php
[line] => 291
[function] => _execute
[class] => Varien_Db_Statement_Pdo_Mysql
[type] => ->
[args] => Array
(
[0] => Array
(
)

)

)

[3] => Array
(
[file] => /var/www/html/lib/Zend/Db/Adapter/Abstract.php
[line] => 480
[function] => execute
[class] => Zend_Db_Statement
[type] => ->
[args] => Array
(
[0] => Array
(
)

)

)

[4] => Array
(
[file] => /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php
[line] => 238
[function] => query
[class] => Zend_Db_Adapter_Abstract
[type] => ->
[args] => Array
(
[0] => ALTER TABLE `sales_flat_order` ADD COLUMN `po_currency` varchar
[1] => Array
(
)

)

)

[5] => Array
(
[file] => /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php
[line] => 428
[function] => query
[class] => Zend_Db_Adapter_Pdo_Abstract
[type] => ->
[args] => Array
(
[0] => ALTER TABLE `sales_flat_order` ADD COLUMN `po_currency` varchar
[1] => Array
(
)

)

)

[6] => Array
(
[file] => /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php
[line] => 347
[function] => query
[class] => Varien_Db_Adapter_Pdo_Mysql
[type] => ->
[args] => Array
(
[0] => ALTER TABLE `sales_flat_order` ADD COLUMN `po_currency` varchar
)

)

[7] => Array
(
[file] => /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php
[line] => 848
[function] => raw_query
[class] => Varien_Db_Adapter_Pdo_Mysql
[type] => ->
[args] => Array
(
[0] => ALTER TABLE `sales_flat_order` ADD COLUMN `po_currency` varchar
)

)

[8] => Array
(
[file] => /var/www/html/.modman/Magento-MDLogistics-Inventory/Mdlogistics/sql/ebuynow_mdlogistics_setup/install-0.8.2.php
[line] => 54
[function] => addColumn
[class] => Varien_Db_Adapter_Pdo_Mysql
[type] => ->
[args] => Array
(
[0] => sales_flat_order
[1] => po_currency
[2] => varchar
[3] =>
[4] => Array
(
[nullable] => 1
[default] =>
[comment] => Currency used for this order
)

)

)

[9] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php
[line] => 624
[args] => Array
(
[0] => /var/www/html/.modman/Magento-MDLogistics-Inventory/Mdlogistics/sql/ebuynow_mdlogistics_setup/install-0.8.2.php
)

[function] => include
)

[10] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php
[line] => 421
[function] => _modifyResourceDb
[class] => Mage_Core_Model_Resource_Setup
[type] => ->
[args] => Array
(
[0] => install
[1] =>
[2] => 0.8.2
)

)

[11] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php
[line] => 327
[function] => _installResourceDb
[class] => Mage_Core_Model_Resource_Setup
[type] => ->
[args] => Array
(
[0] => 0.8.2
)

)

[12] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php
[line] => 235
[function] => applyUpdates
[class] => Mage_Core_Model_Resource_Setup
[type] => ->
[args] => Array
(
)

)

[13] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/App.php
[line] => 417
[function] => applyAllUpdates
[class] => Mage_Core_Model_Resource_Setup
[type] => ::
[args] => Array
(
)

)

[14] => Array
(
[file] => /var/www/html/app/code/core/Mage/Core/Model/App.php
[line] => 343
[function] => _initModules
[class] => Mage_Core_Model_App
[type] => ->
[args] => Array
(
)

)

[15] => Array
(
[file] => /var/www/html/app/Mage.php
[line] => 684
[function] => run
[class] => Mage_Core_Model_App
[type] => ->
[args] => Array
(
[0] => Array
(
[scope_code] =>
[scope_type] => store
[options] => Array
(
)

)

)

)

[16] => Array
(
[file] => /var/www/html/index.php
[line] => 88
[function] => run
[class] => Mage
[type] => ::
[args] => Array
(
[0] =>
[1] => store
)

)

)

[previous:Exception:private] =>
[errorInfo] => Array
(
[0] => 42000
[1] => 1064
[2] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
)

)

다른 참고 사항:

6 개의 테이블 변경 중 5 개는 열이 이미 존재하더라도 잘 실행되지만,통화 추가 열의 주석을 해제 할 때마다 위에 포함 된 오류가 발생합니다.나는 코드를 살펴 보았고,이 매우 간단한 설치 스크립트에서 잘못 튀어 나와있는 것을 정말로 보지 못했습니다.어떤 아이디어?

도움이 되었습니까?

해결책

선택한 답변에서 볼 수 있듯이 여기,타입_바커가 더 이상 사용되지 않습니다.입력_텍스트를 사용해보십시오.

다른 팁

완벽한 솔루션은 아니지만 잘못된 열을 지정하는 대체 방법을 사용하여 특정 문제를 해결했습니다.

이 수정으로 포_통화 변경을 대체:

$installer->getConnection()
    ->addColumn($table, 'po_currency', 'varchar(3) default NULL');

나는 내가 전에 무엇을 잘못했는지 이해하지 못하지만 적어도 이것은 효과가 있습니다.이 문제를 탐색하는 사람이 나에게 문제를 설명 할 수 있다면 여전히 감사하겠습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top