Skip to content

Commit fc60c25

Browse files
committed
Workaround for oracle specifig begining of queries + missing requirement
1 parent 8c8ea56 commit fc60c25

2 files changed

Lines changed: 23 additions & 29 deletions

File tree

Orm/Xtensive.Orm.Tests/Issues/IssueJira0570_InOperationDoesNotCreateTemporaryTable.cs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2016-2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Kulakov
55
// Created: 2016.08.24
66

@@ -374,7 +374,7 @@ public void StoreThenIncludeTest()
374374
var businessUnitIds = session.Query.All<BusinessUnit>().Select(bu=>bu.Id).ToList();
375375

376376
var bounds = new Tuple<DateTime, DateTime, string>[26];
377-
for (int i = 0; i < bounds.Length; i++) {
377+
for (var i = 0; i < bounds.Length; i++) {
378378
bounds[i] = new Tuple<DateTime, DateTime, string>(DateTime.UtcNow, DateTime.UtcNow, "");
379379
}
380380
var list = session.Query.All<Job>()
@@ -393,7 +393,7 @@ public void IncludeThenStoreTest()
393393
var businessUnitIds = session.Query.All<BusinessUnit>().Select(bu => bu.Id).ToList();
394394

395395
var bounds = new Tuple<DateTime, DateTime, string>[26];
396-
for (int i = 0; i < bounds.Length; i++) {
396+
for (var i = 0; i < bounds.Length; i++) {
397397
bounds[i] = new Tuple<DateTime, DateTime, string>(DateTime.UtcNow, DateTime.UtcNow, "");
398398
}
399399
var list = session.Query.All<Job>()
@@ -412,7 +412,7 @@ public void IncludeWithoutStoreTest()
412412
var businessUnitIds = session.Query.All<BusinessUnit>().Select(bu => bu.Id).ToList();
413413

414414
var bounds = new Tuple<DateTime, DateTime, string>[26];
415-
for (int i = 0; i < bounds.Length; i++) {
415+
for (var i = 0; i < bounds.Length; i++) {
416416
bounds[i] = new Tuple<DateTime, DateTime, string>(DateTime.UtcNow, DateTime.UtcNow, "");
417417
}
418418
var list = session.Query.All<Job>()
@@ -424,12 +424,13 @@ public void IncludeWithoutStoreTest()
424424
[Test]
425425
public void StoreWithoutIncludeTest()
426426
{
427+
Require.AllFeaturesSupported(ProviderFeatures.TemporaryTables);
427428
using (var session = Domain.OpenSession())
428429
using (var transaction = session.OpenTransaction()) {
429430
var businessUnitIds = session.Query.All<BusinessUnit>().Select(bu => bu.Id).ToList();
430431

431432
var bounds = new Tuple<DateTime, DateTime, string>[26];
432-
for (int i = 0; i < bounds.Length; i++) {
433+
for (var i = 0; i < bounds.Length; i++) {
433434
bounds[i] = new Tuple<DateTime, DateTime, string>(DateTime.UtcNow, DateTime.UtcNow, "");
434435
}
435436
var list = session.Query.All<Job>()
@@ -505,15 +506,16 @@ private void PopulateEnums()
505506
private void PopulateCustomers()
506507
{
507508
customerIds = new int[160];
508-
for (int i = 0; i < 160; i++)
509+
for (var i = 0; i < 160; i++) {
509510
customerIds[i] = new Customer().Id;
511+
}
510512
}
511513

512514
private void PopulateInvoices()
513515
{
514516
foreach (var customer in Query.All<Customer>()) {
515517
foreach (var status in Enum.GetValues(typeof(InvoiceStatus))) {
516-
new Invoice {
518+
_ = new Invoice {
517519
Active = true,
518520
Customer = customer,
519521
InvoicedOn = DateTime.Now,
@@ -527,7 +529,7 @@ private void PopulatePayments()
527529
{
528530
var generator = new Random();
529531
foreach (var invoice in Query.All<Invoice>().Where(el => el.Status.In(queryableInvoiceStatuses))) {
530-
new Payment {
532+
_ = new Payment {
531533
Active = true,
532534
Amount = new decimal(generator.Next(10000000, 200000000) / 100000),
533535
Invoice = invoice,
@@ -538,26 +540,18 @@ private void PopulatePayments()
538540

539541
private void PopulateBusinessUnits()
540542
{
541-
new BusinessUnit() {
542-
Active = true,
543-
QuickbooksClass = ""
544-
};
545-
546-
new BusinessUnit() {
547-
Active = true,
548-
QuickbooksClass = ""
549-
};
550-
551-
new BusinessUnit() {
552-
Active = true,
553-
QuickbooksClass = ""
554-
};
543+
for(var i = 0; i < 3; i++) {
544+
_ = new BusinessUnit() {
545+
Active = true,
546+
QuickbooksClass = ""
547+
};
548+
}
555549
}
556550

557551
private void PopulateJobs()
558552
{
559553
foreach (var bu in Query.All<BusinessUnit>()) {
560-
new Job() {
554+
_ = new Job() {
561555
BusinessUnit = bu
562556
};
563557
}
@@ -585,7 +579,7 @@ protected override DomainConfiguration BuildConfiguration()
585579
{
586580
var configuration = base.BuildConfiguration();
587581
configuration.UpgradeMode = DomainUpgradeMode.Recreate;
588-
configuration.Types.Register(typeof (Payment).Assembly, typeof (Payment).Namespace);
582+
configuration.Types.Register(typeof(Payment).Assembly, typeof(Payment).Namespace);
589583
return configuration;
590584
}
591585
}

Orm/Xtensive.Orm.Tests/Issues/IssueJira0793_FieldValidationTriggersLazyLoadFieldsFetch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ public Disposable Attach(Session session)
8989

9090
private void Encount(object sender, DbCommandEventArgs eventArgs)
9191
{
92-
var text = eventArgs.Command.CommandText.Substring(0, 6);
93-
if (text.Equals("SELECT", StringComparison.OrdinalIgnoreCase)) {
92+
var text = eventArgs.Command.CommandText.Substring(0, 30);
93+
if (text.Contains("SELECT", StringComparison.OrdinalIgnoreCase)) {
9494
SelectCount++;
9595
}
96-
else if (text.Equals("UPDATE", StringComparison.OrdinalIgnoreCase)) {
96+
else if (text.Contains("UPDATE", StringComparison.OrdinalIgnoreCase)) {
9797
UpdateCount++;
9898
}
9999
else {

0 commit comments

Comments
 (0)