Closed sdlins closed 5 years ago
Try master.
Did you mean master
db? I didn't get you @samdark.
master branch of Yii instead 2.0.15.1
Oh, sorry. I will try.
Tried against a dev-master
install and now the error message and the sql is different:
Exception: SQLSTATE[07002]: [Microsoft][ODBC Driver 13 for SQL Server]COUNT field incorrect or syntax error
The SQL being executed was: INSERT INTO [ALTERACAOCRONO_RBAC_ITEM] ([name], [type], [description], [rule_name], [data], [created_at], [updated_at]) VALUES (NULL, 1, NULL, NULL, CONVERT(VARBINARY, NULL), 1530815512, 1530815512) (C:\...\vendor\yiisoft\yii2\db\Schema.php:664)
When I get home I will try everything in my LAMP environment to check the results.
Any idea what that means?
Not really because I had not time to debug this time. But I will be able to debug within some minutes. I will update this answer after that.
-- @samdark, update:
When we reach \yii\db\QueryBuilder::prepareInsertValues()
we have empty $params
and these $columns
:
name:"solicitante"
type:1
description:null
rule_name:null
data:yii\db\Expression
expression:"CONVERT(VARBINARY, :qp0)" // Please, note ":qp0"
params:array(1)
created_at:1530821884
updated_at:1530821884
And inside prepareInsertValues()
we have this code:
if ($value instanceof ExpressionInterface) {
$placeholders[] = $this->buildExpression($value, $params);
$params
here are:
:qp0:"solicitante"
:qp1:1
:qp2:null
:qp3:null
But when \yii\db\ExpressionBuilder::build()
is called inside buildExpression()
all $params
are merged with $expression->params
. At this point my :qp0
is changed from 'solicitante'
to null
.
PS: Here I am talking about the last error as this comment above.
I tried a solution but since I am at work I cant dispend much time and at home I dont have win nor mssql. So, I hope to be able to help in next days but I cant guarantee that I will have enough time at work, sorry.
Closing since normalizeTableRowData()
seems fixed by @marcelodeandrade.
I have this RBAC migration:
That is resulting in this error:
The most strange is that when I execute the sql pointed in the error right in the MSSQL manager it works fine.
I tryed to change the field
data
from the typebinary
tostring
and rerun the migration just to check the behavior and it works fine too. So I think thatQueryBuilder::normalizeTableRowData()
could be failing somehow that I still could not discover debugging the code.Additional info