【发布时间】:2013-08-19 06:14:44
【问题描述】:
我从今天早上开始从生产站点收到此错误,我想知道为什么我在 UAT 或开发人员环境中没有收到相同的错误..
有没有人熟悉这样的错误?
CDbException
Description
CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "1,076"
Source File
C:\inetpub\wwwroot\framework1.0\db\CDbCommand.php(372)
00360: }
00361:
00362: if($this->_connection->enableProfiling)
00363: Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00364:
00365: return $result;
00366: }
00367: catch(Exception $e)
00368: {
00369: if($this->_connection->enableProfiling)
00370: Yii::endProfile('system.db.CDbCommand.query('.$this->getText().')','system.db.CDbCommand.query');
00371: Yii::log('Error in querying SQL: '.$this->getText().$par,CLogger::LEVEL_ERROR,'system.db.CDbCommand');
00372: throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
00373: array('{error}'=>$e->getMessage())));
00374: }
00375: }
00376: }
还附上截图.. 该应用程序基于 yii 框架和 postgress 数据库。
非常感谢快速回复。
【问题讨论】:
-
很可能有人在您的一个输入字段中输入了
1,076作为数字,而您将其发送到数据库中。不过,对于 DB,它应该是1.076。您需要先转换为正确的格式。 -
或者,很可能是
1076;许多人会用千位分隔符写1,123.00(美国/澳大利亚/英国表格)或1.123,00(欧盟表格)之类的东西。 PostgreSQL 不接受带有千位分隔符的整数。 -
@CraigRinger 不,它在我的开发端确实有效。所以我想知道这怎么可能。此外,数字 1,076 有时也会更改为 1064 ......而且这也不会由于用户输入或类型误用而发生......
-
我同意。这看起来像一个语言环境问题。检查两台服务器上的 PHP 设置以及可用的语言环境。
标签: sql database postgresql yii syntax-error