"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/framework/db/mssql/QueryBuilderTest.php" between
yii2-2.0.36.tar.gz and yii2-2.0.37.tar.gz

About: Yii 2 is a high-performance component-based PHP framework for developing large-scale Web applications (source).

QueryBuilderTest.php  (yii2-2.0.36):QueryBuilderTest.php  (yii2-2.0.37)
skipping to change at line 279 skipping to change at line 279
'regular-values' => [ 'regular-values' => [
'customer', 'customer',
[ [
'email' => 'test@example.com', 'email' => 'test@example.com',
'name' => 'silverfire', 'name' => 'silverfire',
'address' => 'Kyiv {{city}}, Ukraine', 'address' => 'Kyiv {{city}}, Ukraine',
'is_active' => false, 'is_active' => false,
'related_id' => null, 'related_id' => null,
], ],
[], [],
$this->replaceQuotes('INSERT INTO [[customer]] ([[email]], [[nam $this->replaceQuotes('SET NOCOUNT ON;DECLARE @temporary_inserted
e]], [[address]], [[is_active]], [[related_id]]) OUTPUT INSERTED.* VALUES (:qp0, TABLE ([id] int , [email] varchar(128) , [name] varchar(128) NULL, [address] te
:qp1, :qp2, :qp3, :qp4)'), xt NULL, [status] int NULL, [profile_id] int NULL);' .
'INSERT INTO [[customer]] ([[email]], [[name]], [[address]],
[[is_active]], [[related_id]]) OUTPUT INSERTED.* INTO @temporary_inserted VALUE
S (:qp0, :qp1, :qp2, :qp3, :qp4);' .
'SELECT * FROM @temporary_inserted'),
[ [
':qp0' => 'test@example.com', ':qp0' => 'test@example.com',
':qp1' => 'silverfire', ':qp1' => 'silverfire',
':qp2' => 'Kyiv {{city}}, Ukraine', ':qp2' => 'Kyiv {{city}}, Ukraine',
':qp3' => false, ':qp3' => false,
':qp4' => null, ':qp4' => null,
], ],
], ],
'params-and-expressions' => [ 'params-and-expressions' => [
'{{%type}}', '{{%type}}',
[ [
'{{%type}}.[[related_id]]' => null, '{{%type}}.[[related_id]]' => null,
'[[time]]' => new Expression('now()'), '[[time]]' => new Expression('now()'),
], ],
[], [],
'INSERT INTO {{%type}} ({{%type}}.[[related_id]], [[time]]) OUTP 'SET NOCOUNT ON;DECLARE @temporary_inserted TABLE ([int_col] int
UT INSERTED.* VALUES (:qp0, now())', , [int_col2] int NULL, [tinyint_col] tinyint NULL, [smallint_col] smallint NULL
, [char_col] char(100) , [char_col2] varchar(100) NULL, [char_col3] text NULL, [
float_col] decimal , [float_col2] float NULL, [blob_col] varbinary(MAX) NULL, [n
umeric_col] decimal NULL, [time] datetime , [bool_col] tinyint , [bool_col2] tin
yint NULL);' .
'INSERT INTO {{%type}} ({{%type}}.[[related_id]], [[time]]) OUTP
UT INSERTED.* INTO @temporary_inserted VALUES (:qp0, now());' .
'SELECT * FROM @temporary_inserted',
[ [
':qp0' => null, ':qp0' => null,
], ],
], ],
'carry passed params' => [ 'carry passed params' => [
'customer', 'customer',
[ [
'email' => 'test@example.com', 'email' => 'test@example.com',
'name' => 'sergeymakinen', 'name' => 'sergeymakinen',
'address' => '{{city}}', 'address' => '{{city}}',
'is_active' => false, 'is_active' => false,
'related_id' => null, 'related_id' => null,
'col' => new Expression('CONCAT(:phFoo, :phBar)', [':phFoo' => 'foo']), 'col' => new Expression('CONCAT(:phFoo, :phBar)', [':phFoo' => 'foo']),
], ],
[':phBar' => 'bar'], [':phBar' => 'bar'],
$this->replaceQuotes('INSERT INTO [[customer]] ([[email]], [[nam $this->replaceQuotes('SET NOCOUNT ON;DECLARE @temporary_inserted
e]], [[address]], [[is_active]], [[related_id]], [[col]]) OUTPUT INSERTED.* VALU TABLE ([id] int , [email] varchar(128) , [name] varchar(128) NULL, [address] te
ES (:qp1, :qp2, :qp3, :qp4, :qp5, CONCAT(:phFoo, :phBar))'), xt NULL, [status] int NULL, [profile_id] int NULL);' .
'INSERT INTO [[customer]] ([[email]], [[name]], [[address]],
[[is_active]], [[related_id]], [[col]]) OUTPUT INSERTED.* INTO @temporary_inser
ted VALUES (:qp1, :qp2, :qp3, :qp4, :qp5, CONCAT(:phFoo, :phBar));' .
'SELECT * FROM @temporary_inserted'),
[ [
':phBar' => 'bar', ':phBar' => 'bar',
':qp1' => 'test@example.com', ':qp1' => 'test@example.com',
':qp2' => 'sergeymakinen', ':qp2' => 'sergeymakinen',
':qp3' => '{{city}}', ':qp3' => '{{city}}',
':qp4' => false, ':qp4' => false,
':qp5' => null, ':qp5' => null,
':phFoo' => 'foo', ':phFoo' => 'foo',
], ],
], ],
skipping to change at line 342 skipping to change at line 348
->from('customer') ->from('customer')
->where([ ->where([
'email' => 'test@example.com', 'email' => 'test@example.com',
'name' => 'sergeymakinen', 'name' => 'sergeymakinen',
'address' => '{{city}}', 'address' => '{{city}}',
'is_active' => false, 'is_active' => false,
'related_id' => null, 'related_id' => null,
'col' => new Expression('CONCAT(:phFoo, :phBar)', [':phF oo' => 'foo']), 'col' => new Expression('CONCAT(:phFoo, :phBar)', [':phF oo' => 'foo']),
]), ]),
[':phBar' => 'bar'], [':phBar' => 'bar'],
$this->replaceQuotes('INSERT INTO [[customer]] ([[email]], [[nam $this->replaceQuotes('SET NOCOUNT ON;DECLARE @temporary_inserted
e]], [[address]], [[is_active]], [[related_id]]) OUTPUT INSERTED.* SELECT [[emai TABLE ([id] int , [email] varchar(128) , [name] varchar(128) NULL, [address] te
l]], [[name]], [[address]], [[is_active]], [[related_id]] FROM [[customer]] WHER xt NULL, [status] int NULL, [profile_id] int NULL);' .
E ([[email]]=:qp1) AND ([[name]]=:qp2) AND ([[address]]=:qp3) AND ([[is_active]] 'INSERT INTO [[customer]] ([[email]], [[name]], [[address]],
=:qp4) AND ([[related_id]] IS NULL) AND ([[col]]=CONCAT(:phFoo, :phBar))'), [[is_active]], [[related_id]]) OUTPUT INSERTED.* INTO @temporary_inserted SELEC
T [[email]], [[name]], [[address]], [[is_active]], [[related_id]] FROM [[custome
r]] WHERE ([[email]]=:qp1) AND ([[name]]=:qp2) AND ([[address]]=:qp3) AND ([[is_
active]]=:qp4) AND ([[related_id]] IS NULL) AND ([[col]]=CONCAT(:phFoo, :phBar))
;' .
'SELECT * FROM @temporary_inserted'),
[ [
':phBar' => 'bar', ':phBar' => 'bar',
':qp1' => 'test@example.com', ':qp1' => 'test@example.com',
':qp2' => 'sergeymakinen', ':qp2' => 'sergeymakinen',
':qp3' => '{{city}}', ':qp3' => '{{city}}',
':qp4' => false, ':qp4' => false,
':phFoo' => 'foo', ':phFoo' => 'foo',
], ],
], ],
]; ];
skipping to change at line 390 skipping to change at line 398
'query' => [ 'query' => [
3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [status]=[EXCLUDED].[status ] WHEN NOT MATCHED THEN INSERT ([email], [status]) VALUES ([EXCLUDED].[email], [ EXCLUDED].[status]);', 3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [status]=[EXCLUDED].[status ] WHEN NOT MATCHED THEN INSERT ([email], [status]) VALUES ([EXCLUDED].[email], [ EXCLUDED].[status]);',
], ],
'query with update part' => [ 'query with update part' => [
3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [address]=:qp1, [status]=:q p2, [orders]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [status] ) VALUES ([EXCLUDED].[email], [EXCLUDED].[status]);', 3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [address]=:qp1, [status]=:q p2, [orders]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [status] ) VALUES ([EXCLUDED].[email], [EXCLUDED].[status]);',
], ],
'query without update part' => [ 'query without update part' => [
3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN NOT MATCHED THEN INSERT ([email], [status]) VALUES ([EXCLUDED].[email], [EXCLUDED].[status]);', 3 => 'MERGE [T_upsert] WITH (HOLDLOCK) USING (SELECT [email], 2 AS [status] FROM [customer] WHERE [name]=:qp0 ORDER BY (SELECT NULL) OFFSET 0 RO WS FETCH NEXT 1 ROWS ONLY) AS [EXCLUDED] ([email], [status]) ON ([T_upsert].[ema il]=[EXCLUDED].[email]) WHEN NOT MATCHED THEN INSERT ([email], [status]) VALUES ([EXCLUDED].[email], [EXCLUDED].[status]);',
], ],
'values and expressions' => [ 'values and expressions' => [
3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]] 3 => 'SET NOCOUNT ON;DECLARE @temporary_inserted TABLE ([id] int
) OUTPUT INSERTED.* VALUES (:qp0, now())', , [ts] int NULL, [email] varchar(128) , [recovery_email] varchar(128) NULL, [ad
dress] text NULL, [status] tinyint , [orders] int , [profile_id] int NULL);' .
'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]])
OUTPUT INSERTED.* INTO @temporary_inserted VALUES (:qp0, now());' .
'SELECT * FROM @temporary_inserted',
], ],
'values and expressions with update part' => [ 'values and expressions with update part' => [
3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]] 3 => 'SET NOCOUNT ON;DECLARE @temporary_inserted TABLE ([id] int
) OUTPUT INSERTED.* VALUES (:qp0, now())', , [ts] int NULL, [email] varchar(128) , [recovery_email] varchar(128) NULL, [ad
dress] text NULL, [status] tinyint , [orders] int , [profile_id] int NULL);' .
'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]])
OUTPUT INSERTED.* INTO @temporary_inserted VALUES (:qp0, now());' .
'SELECT * FROM @temporary_inserted',
], ],
'values and expressions without update part' => [ 'values and expressions without update part' => [
3 => 'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]] 3 => 'SET NOCOUNT ON;DECLARE @temporary_inserted TABLE ([id] int
) OUTPUT INSERTED.* VALUES (:qp0, now())', , [ts] int NULL, [email] varchar(128) , [recovery_email] varchar(128) NULL, [ad
dress] text NULL, [status] tinyint , [orders] int , [profile_id] int NULL);' .
'INSERT INTO {{%T_upsert}} ({{%T_upsert}}.[[email]], [[ts]])
OUTPUT INSERTED.* INTO @temporary_inserted VALUES (:qp0, now());' .
'SELECT * FROM @temporary_inserted',
], ],
'query, values and expressions with update part' => [ 'query, values and expressions with update part' => [
3 => 'MERGE {{%T_upsert}} WITH (HOLDLOCK) USING (SELECT :phEmail AS [email], now() AS [[time]]) AS [EXCLUDED] ([email], [[time]]) ON ({{%T_upser t}}.[email]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [ts]=:qp1, [[orders ]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [[time]]) VALUES ( [EXCLUDED].[email], [EXCLUDED].[[time]]);', 3 => 'MERGE {{%T_upsert}} WITH (HOLDLOCK) USING (SELECT :phEmail AS [email], now() AS [[time]]) AS [EXCLUDED] ([email], [[time]]) ON ({{%T_upser t}}.[email]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [ts]=:qp1, [[orders ]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [[time]]) VALUES ( [EXCLUDED].[email], [EXCLUDED].[[time]]);',
], ],
'query, values and expressions without update part' => [ 'query, values and expressions without update part' => [
3 => 'MERGE {{%T_upsert}} WITH (HOLDLOCK) USING (SELECT :phEmail AS [email], now() AS [[time]]) AS [EXCLUDED] ([email], [[time]]) ON ({{%T_upser t}}.[email]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [ts]=:qp1, [[orders ]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [[time]]) VALUES ( [EXCLUDED].[email], [EXCLUDED].[[time]]);', 3 => 'MERGE {{%T_upsert}} WITH (HOLDLOCK) USING (SELECT :phEmail AS [email], now() AS [[time]]) AS [EXCLUDED] ([email], [[time]]) ON ({{%T_upser t}}.[email]=[EXCLUDED].[email]) WHEN MATCHED THEN UPDATE SET [ts]=:qp1, [[orders ]]=T_upsert.orders + 1 WHEN NOT MATCHED THEN INSERT ([email], [[time]]) VALUES ( [EXCLUDED].[email], [EXCLUDED].[[time]]);',
], ],
'no columns to update' => [ 'no columns to update' => [
3 => 'MERGE [T_upsert_1] WITH (HOLDLOCK) USING (VALUES (:qp0)) A S [EXCLUDED] ([a]) ON ([T_upsert_1].[a]=[EXCLUDED].[a]) WHEN NOT MATCHED THEN IN SERT ([a]) VALUES ([EXCLUDED].[a]);', 3 => 'MERGE [T_upsert_1] WITH (HOLDLOCK) USING (VALUES (:qp0)) A S [EXCLUDED] ([a]) ON ([T_upsert_1].[a]=[EXCLUDED].[a]) WHEN NOT MATCHED THEN IN SERT ([a]) VALUES ([EXCLUDED].[a]);',
], ],
 End of changes. 7 change blocks. 
19 lines changed or deleted 51 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)