チェンジセット 1643 (default)
- 日時:
- 2024/04/19 17:28:43 (6ヵ月前)
- 場所:
- framework/trunk
- ファイル:
-
- 10個の追加
- 9個の更新
凡例:
- 未変更
- 追加
- 削除
-
framework/trunk/CoreLibrary/Resources/Data/DbDataOperator.st
r1590 r1643 15 15 ${Insert_FieldValues} 16 16 ) 17 ${Insert_SeqVal} 18 19 InsertDefault= 20 INSERT INTO 21 ${Insert_TableName} 22 DEFAULT VALUES 17 23 ${Insert_SeqVal} 18 24 … … 46 52 ) 47 53 54 ImportDefault= 55 INSERT INTO 56 ${Import_TableName} 57 DEFAULT VALUES 58 48 59 Clear= 49 60 DELETE FROM -
framework/trunk/CoreLibrary/Sources/Data/Common/CommonDbUtility.cs
r1568 r1643 114 114 115 115 /// <summary> 116 /// デフォルト値のみの INSERT を実行できるかどうかを返します。 117 /// </summary> 118 /// <value> 119 /// 実行できる場合は <see langword="true"/>。 120 /// それ以外の場合は <see langword="false"/>c>。 121 /// </value> 122 public virtual bool SupportsInsertDefaultValues 123 { 124 get 125 { 126 return false; 127 } 128 } 129 130 /// <summary> 116 131 /// LIKE 比較に指定する値として、特殊記号をエスケープした値を返します。 117 132 /// </summary> -
framework/trunk/CoreLibrary/Sources/Data/DbDataOperator.cs
r1590 r1643 768 768 } 769 769 770 if (fieldNames.Length == 0 )770 if (fieldNames.Length == 0 && !utility.SupportsInsertDefaultValues) 771 771 { 772 772 throw new ArgumentException(Resources.Argument_DbTableManager_TargetFieldNotFound, "bean"); … … 788 788 789 789 using (ICommonDbCommand command 790 = transaction.CreateCommand(Template, "Insert", option)) 790 = transaction.CreateCommand( 791 Template, 792 fieldNames.Length == 0 && utility.SupportsInsertDefaultValues 793 ? "InsertDefault" 794 : "Insert", 795 option)) 791 796 { 792 797 foreach (KeyValuePair<string, object> param in parameterValues) … … 2672 2677 = transaction.CreateCommand( 2673 2678 Template, 2674 "Import", 2679 fieldNamesBuilder.Length == 0 && utility.SupportsInsertDefaultValues 2680 ? "ImportDefault" 2681 : "Import", 2675 2682 new SqlStatementOption 2676 2683 { -
framework/trunk/CoreLibrary/Sources/Data/ICommonDbUtility.cs
r1568 r1643 58 58 bool SupportsMultiStatement { get; } 59 59 60 /// <summary> 61 /// デフォルト値のみの INSERT を実行できるかどうかを返します。 62 /// </summary> 63 /// <value> 64 /// 実行できる場合は <see langword="true"/>。 65 /// それ以外の場合は <see langword="false"/>c>。 66 /// </value> 67 bool SupportsInsertDefaultValues { get; } 68 60 69 61 70 /// <summary> -
framework/trunk/CoreLibrary/Sources/Data/Sql/SqlUtility.cs
r1568 r1643 90 90 91 91 /// <summary> 92 /// デフォルト値のみの INSERT を実行できるかどうかを返します。 93 /// </summary> 94 /// <value> 95 /// 実行できる場合は <see langword="true"/>。 96 /// それ以外の場合は <see langword="false"/>c>。 97 /// </value> 98 public override bool SupportsInsertDefaultValues 99 { 100 get 101 { 102 return true; 103 } 104 } 105 106 /// <summary> 92 107 /// LIKE 比較に指定する値として、特殊記号をエスケープした値を返します。 93 108 /// </summary> -
framework/trunk/CoreTest/CoreTest.csproj
r1630 r1643 355 355 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\16-ConditionWithValue-2.txt" /> 356 356 </ItemGroup> 357 <ItemGroup> 358 <EmbeddedResource Include="TestResources\Data\DbDataOperatorBasicTest\TestInsertEmpty.txt" /> 359 </ItemGroup> 360 <ItemGroup> 361 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\17-AppendEmpty-0.txt" /> 362 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\17-AppendEmpty-2.txt" /> 363 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\18-TruncateEmpty-0.txt" /> 364 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\18-TruncateEmpty-2.txt" /> 365 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\19-ResetEmpty-0.txt" /> 366 <EmbeddedResource Include="TestResources\Data\DbDataOperatorImportTest\19-ResetEmpty-2.txt" /> 367 </ItemGroup> 357 368 <Import Project="$(MSBuildThisFileDirectory)..\MSBuild.Common.targets" /> 358 369 </Project> -
framework/trunk/CoreTest/Sources/Data/DbDataOperatorBasicTest.cs
r1480 r1643 97 97 transaction, 98 98 Stores.SameAs(GetType().Assembly, ResourceNamePrefix + "TestInsert.txt"), 99 "CompareTest"); 100 }); 101 } 102 103 /// <summary> 104 /// 継承された空の <see cref="DbDataBean"/> を使用して <c>INSERT</c> を実行します。 105 /// </summary> 106 [Test] 107 public void TestInsertEmpty() 108 { 109 Execute( 110 delegate(ICommonDbTransaction transaction) 111 { 112 DbDataOperator.Insert( 113 transaction, 114 new DumbBean()); 115 116 AutoSequenceNumberBean autoSequenceNumberBean1 = new AutoSequenceNumberBean(); 117 DbDataOperator.Insert( 118 transaction, 119 autoSequenceNumberBean1); 120 121 Assert.That( 122 transaction, 123 Stores.SameAs(GetType().Assembly, ResourceNamePrefix + "TestInsertEmpty.txt"), 99 124 "CompareTest"); 100 125 }); -
framework/trunk/CoreTest/Sources/Data/DbDataOperatorImportTest.cs
r1590 r1643 82 82 [TestCase(@"16-ConditionWithValue.txt", 0, 2, @"16-ConditionWithValue-0.txt")] 83 83 [TestCase(@"16-ConditionWithValue.txt", 2, 2, @"16-ConditionWithValue-2.txt")] 84 [TestCase(@"17-AppendEmpty.txt", 0, 2, @"17-AppendEmpty-0.txt")] 85 [TestCase(@"17-AppendEmpty.txt", 2, 2, @"17-AppendEmpty-2.txt")] 86 [TestCase(@"18-TruncateEmpty.txt", 0, 2, @"18-TruncateEmpty-0.txt")] 87 [TestCase(@"18-TruncateEmpty.txt", 2, 2, @"18-TruncateEmpty-2.txt")] 88 [TestCase(@"19-ResetEmpty.txt", 0, 2, @"19-ResetEmpty-0.txt")] 89 [TestCase(@"19-ResetEmpty.txt", 2, 2, @"19-ResetEmpty-2.txt")] 84 90 [TestCase(@"51-MissingColumnData.txt", 0, 3, @"51-MissingColumnData-0.txt")] 85 91 [TestCase(@"51-MissingColumnData.txt", 2, 3, @"51-MissingColumnData-2.txt")] -
framework/trunk/CoreTest/Sources/Data/DbDataOperatorTestBase.cs
r1480 r1643 75 75 PRIMARY KEY CLUSTERED ([F_Id]) 76 76 ); 77 IF OBJECT_ID(N'SFF_DbDataOperator_Dumb', 'U') IS NOT NULL 78 DROP TABLE [SFF_DbDataOperator_Dumb]; 79 CREATE TABLE [SFF_DbDataOperator_Dumb] 80 ( 81 [F_Id] INT, 82 [F_Int32] INT, 83 [F_String] NVARCHAR(100), 84 [F_Double] FLOAT 85 ); 77 86 " 78 87 }, … … 93 102 IF OBJECT_ID(N'SFF_DbDataOperator_Seq', 'U') IS NOT NULL 94 103 DROP TABLE [SFF_DbDataOperator_Seq]; 104 IF OBJECT_ID(N'SFF_DbDataOperator_Dumb', 'U') IS NOT NULL 105 DROP TABLE [SFF_DbDataOperator_Dumb]; 95 106 " 96 107 }, … … 469 480 } 470 481 } 482 483 484 /// <summary> 485 /// プライマリーキーの無いテーブルに対応したビーンです。 486 /// </summary> 487 [DbTable("SFF_DbDataOperator_Dumb")] 488 protected sealed class DumbBean : 489 DbDataBean 490 { 491 /// <summary> 492 /// ID フィールドの値。 493 /// </summary> 494 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 495 private DbVValue<int> id; 496 497 /// <summary> 498 /// <see cref="int"/> 型フィールドの値。 499 /// </summary> 500 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 501 private DbVValue<int> int32; 502 503 /// <summary> 504 /// <see cref="string"/> 型フィールドの値。 505 /// </summary> 506 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 507 private DbRValue<string> @string; 508 509 /// <summary> 510 /// <see cref="double"/> 型フィールドの値。 511 /// </summary> 512 [DebuggerBrowsable(DebuggerBrowsableState.Never)] 513 private DbVValue<double> @double; 514 515 516 /// <summary> 517 /// インスタンスを作成します。 518 /// </summary> 519 internal DumbBean() 520 { 521 // AVOID 522 } 523 524 525 /// <summary> 526 /// ID フィールドの値を取得または設定します。 527 /// </summary> 528 /// <value> 529 /// ID フィールドの値。 530 /// </value> 531 [DbField("F_Id")] 532 internal DbVValue<int> Id 533 { 534 get 535 { 536 return id; 537 } 538 539 set 540 { 541 SetValue(value, ref id); 542 } 543 } 544 545 /// <summary> 546 /// <see cref="int"/> 型フィールドの値を取得または設定します。 547 /// </summary> 548 /// <value> 549 /// <see cref="int"/> 型フィールドの値。 550 /// </value> 551 [DbField("F_Int32")] 552 internal DbVValue<int> Int32 553 { 554 get 555 { 556 return int32; 557 } 558 559 set 560 { 561 SetValue(value, ref int32); 562 } 563 } 564 565 /// <summary> 566 /// <see cref="string"/> 型フィールドの値を取得または設定します。 567 /// </summary> 568 /// <value> 569 /// <see cref="string"/> 型フィールドの値。 570 /// </value> 571 [DbField("F_String")] 572 internal DbRValue<string> String 573 { 574 get 575 { 576 return @string; 577 } 578 579 set 580 { 581 SetValue(value, ref @string); 582 } 583 } 584 585 /// <summary> 586 /// <see cref="double"/> 型フィールドの値を取得または設定します。 587 /// </summary> 588 /// <value> 589 /// <see cref="double"/> 型フィールドの値。 590 /// </value> 591 [DbField("F_Double")] 592 internal DbVValue<double> Double 593 { 594 get 595 { 596 return @double; 597 } 598 599 set 600 { 601 SetValue(value, ref @double); 602 } 603 } 604 } 471 605 } 472 606 }
※ 詳しい使い方は
TracChangeset を参照してください。