diff --git a/NETProvider/DDEX/installer/Install.wxs b/NETProvider/DDEX/installer/Install.wxs index 1e68055..506ff7d 100644 --- a/NETProvider/DDEX/installer/Install.wxs +++ b/NETProvider/DDEX/installer/Install.wxs @@ -7,9 +7,7 @@ Version="!(bind.fileVersion.InterBaseSql.VisualStudio.DataTools.dll)" Manufacturer="InterBaseSQL"> - - @@ -44,8 +42,7 @@ - - + @@ -57,9 +54,9 @@ Source="$(var.BaseDir)\installer\in\InterBaseSql.VisualStudio.DataToolsUI.dll" /> - + @@ -69,13 +66,15 @@ + - @@ -107,12 +106,11 @@ - - + diff --git a/NETProvider/DDEX/readme.md b/NETProvider/DDEX/readme.md index 06e4409..c7f22fd 100644 --- a/NETProvider/DDEX/readme.md +++ b/NETProvider/DDEX/readme.md @@ -36,7 +36,7 @@ Modify it like this (for 64bit systems you have to edit "32bit version" of this And substitute (this information you can find using gacutil): - - %Version% with the version of the provider assembly that you have in the GAC (currently 7.11.0.0). + - %Version% with the version of the provider assembly that you have in the GAC (currently 7.12.1.0). Note: Notice, that in configSections there isn't signature of InterBaseClient but the signature of assembly from framework. diff --git a/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider32.reg b/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider32.reg new file mode 100644 index 0000000..2303a09 --- /dev/null +++ b/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider32.reg @@ -0,0 +1,39 @@ +Windows Registry Editor Version 5.00 + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataSources\{108473C1-273A-41BF-AE1E-CA515C423B9F}] +@="InterBase Data Source" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataSources\{108473C1-273A-41BF-AE1E-CA515C423B9F}\SupportingProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}] + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}] +@=".NET Framework Data Provider for InterBase" +"DisplayName"="Provider_DisplayName, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"ShortDisplayName"="Provider_ShortDisplayName, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"Description"="Provider_Description, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"CodeBase"="%PATH%\\InterBaseSql.VisualStudio.DataTools.dll" +"InvariantName"="InterBaseSql.Data.InterBaseClient" +"Technology"="{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects] + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionProperties] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionProperties" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionUIControl] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionUIControl" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataSourceInformation] +@="InterBaseSql.VisualStudio.DataTools.IBDataSourceInformation" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataObjectSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataObjectSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataViewSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataViewSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\Services\{EADC6C1E-17D2-42FF-9816-19850428BCF1}] +@="{0095710D-F7DC-4FA1-8FEB-C8153AA5DF75}" +"Name"="InterBase Provider Object Factory" diff --git a/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider64.reg b/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider64.reg new file mode 100644 index 0000000..4db5f76 --- /dev/null +++ b/NETProvider/DDEX/reg_files/VS2022/InterBaseDDEXProvider64.reg @@ -0,0 +1,39 @@ +Windows Registry Editor Version 5.00 + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataSources\{108473C1-273A-41BF-AE1E-CA515C423B9F}] +@="InterBase Data Source" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataSources\{108473C1-273A-41BF-AE1E-CA515C423B9F}\SupportingProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}] + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}] +@=".NET Framework Data Provider for InterBase" +"DisplayName"="Provider_DisplayName, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"ShortDisplayName"="Provider_ShortDisplayName, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"Description"="Provider_Description, InterBaseSql.VisualStudio.DataTools.Properties.Resources" +"CodeBase"="C:\\Users\\jeffo\\source\\repos\\NETProvider\\trunk\\NETProvider\\DDEX\\src\\InterBaseSql\\VisualStudio\\DataTools\\bin\\InterBaseSql.VisualStudio.DataTools.dll" +"InvariantName"="InterBaseSql.Data.InterBaseClient" +"Technology"="{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects] + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionProperties] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionProperties" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataConnectionUIControl] +@="InterBaseSql.VisualStudio.DataTools.IBDataConnectionUIControl" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataSourceInformation] +@="InterBaseSql.VisualStudio.DataTools.IBDataSourceInformation" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataObjectSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataObjectSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\DataProviders\{ACE0EC8B-0EC7-4C0C-B99A-39E6AE7B5419}\SupportedObjects\DataViewSupport] +@="InterBaseSql.VisualStudio.DataTools.IBDataViewSupport" + +[HKEY_USERS\17.0_390494b1\Software\Microsoft\VisualStudio\17.0_390494b1_Config\Services\{EADC6C1E-17D2-42FF-9816-19850428BCF1}] +@="{0095710D-F7DC-4FA1-8FEB-C8153AA5DF75}" +"Name"="InterBase Provider Object Factory" diff --git a/NETProvider/Demos/ChangeViews Demo/MainForm.cs b/NETProvider/Demos/ChangeViews Demo/MainForm.cs index 6bd6d80..95530ab 100644 --- a/NETProvider/Demos/ChangeViews Demo/MainForm.cs +++ b/NETProvider/Demos/ChangeViews Demo/MainForm.cs @@ -1,4 +1,24 @@ -using System; +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * https://github.com/Embarcadero/IB.NETDataProvider/blob/main/LICENSE. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Initial Developer(s) of the Original Code are listed below. + * Portions created by Embarcadero are Copyright (C) Embarcadero. + * + * All Rights Reserved. + */ + +//$Authors = Embarcadero, Jeff Overcash + +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; diff --git a/NETProvider/Demos/ConnectionBuilder/ConnectionBuilder/Form1.cs b/NETProvider/Demos/ConnectionBuilder/ConnectionBuilder/Form1.cs index 06ba92d..88c0aec 100644 --- a/NETProvider/Demos/ConnectionBuilder/ConnectionBuilder/Form1.cs +++ b/NETProvider/Demos/ConnectionBuilder/ConnectionBuilder/Form1.cs @@ -3,7 +3,7 @@ * Developer's Public License Version 1.0 (the "License"); * you may not use this file except in compliance with the * License. You may obtain a copy of the License at - * https://github.com/FirebirdSQL/NETProvider/blob/master/license.txt. + * https://github.com/Embarcadero/IB.NETDataProvider/blob/main/LICENSE. * * Software distributed under the License is distributed on * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either diff --git a/NETProvider/Demos/EventDemo/Event Demo Readme.docx b/NETProvider/Demos/EventDemo/Event Demo Readme.docx new file mode 100644 index 0000000..92396b9 Binary files /dev/null and b/NETProvider/Demos/EventDemo/Event Demo Readme.docx differ diff --git a/NETProvider/Demos/EventDemo/EventDemo.csproj b/NETProvider/Demos/EventDemo/EventDemo.csproj new file mode 100644 index 0000000..72a036a --- /dev/null +++ b/NETProvider/Demos/EventDemo/EventDemo.csproj @@ -0,0 +1,21 @@ + + + + WinExe + net6.0-windows + enable + true + enable + + + + + + + + + ..\..\..\..\..\..\..\source\repos\NETProvider\trunk\NETProvider\Provider\src\InterBaseSql.Data.InterBaseClient\obj\Debug\net6.0\refint\InterBaseSql.Data.InterBaseClient.dll + + + + \ No newline at end of file diff --git a/NETProvider/Demos/EventDemo/EventDemo.sln b/NETProvider/Demos/EventDemo/EventDemo.sln new file mode 100644 index 0000000..114ccc6 --- /dev/null +++ b/NETProvider/Demos/EventDemo/EventDemo.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32602.215 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventDemo", "EventDemo.csproj", "{A14E6165-FC60-428E-946C-24EDEF068CC3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A14E6165-FC60-428E-946C-24EDEF068CC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A14E6165-FC60-428E-946C-24EDEF068CC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A14E6165-FC60-428E-946C-24EDEF068CC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A14E6165-FC60-428E-946C-24EDEF068CC3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0C6D486C-7701-44C2-B875-33D83F78A5A0} + EndGlobalSection +EndGlobal diff --git a/NETProvider/Demos/EventDemo/MainForm.Designer.cs b/NETProvider/Demos/EventDemo/MainForm.Designer.cs new file mode 100644 index 0000000..ac16582 --- /dev/null +++ b/NETProvider/Demos/EventDemo/MainForm.Designer.cs @@ -0,0 +1,224 @@ +namespace EventDemo +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.grpConnection = new System.Windows.Forms.GroupBox(); + this.btnCloseDatabase = new System.Windows.Forms.Button(); + this.btnOpenDatabase = new System.Windows.Forms.Button(); + this.grpEvents = new System.Windows.Forms.GroupBox(); + this.edEvent = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.btnGenerateEvent = new System.Windows.Forms.Button(); + this.grpRegistration = new System.Windows.Forms.GroupBox(); + this.moRegister = new System.Windows.Forms.TextBox(); + this.btnRegisterEvents = new System.Windows.Forms.Button(); + this.grpReceived = new System.Windows.Forms.GroupBox(); + this.lbReceived = new System.Windows.Forms.ListBox(); + this.btnClearEventsReceived = new System.Windows.Forms.Button(); + this.grpConnection.SuspendLayout(); + this.grpEvents.SuspendLayout(); + this.grpRegistration.SuspendLayout(); + this.grpReceived.SuspendLayout(); + this.SuspendLayout(); + // + // grpConnection + // + this.grpConnection.Controls.Add(this.btnCloseDatabase); + this.grpConnection.Controls.Add(this.btnOpenDatabase); + this.grpConnection.Location = new System.Drawing.Point(28, 15); + this.grpConnection.Name = "grpConnection"; + this.grpConnection.Size = new System.Drawing.Size(200, 100); + this.grpConnection.TabIndex = 0; + this.grpConnection.TabStop = false; + this.grpConnection.Text = "Database Connection"; + // + // btnCloseDatabase + // + this.btnCloseDatabase.Enabled = false; + this.btnCloseDatabase.Location = new System.Drawing.Point(28, 63); + this.btnCloseDatabase.Name = "btnCloseDatabase"; + this.btnCloseDatabase.Size = new System.Drawing.Size(150, 23); + this.btnCloseDatabase.TabIndex = 1; + this.btnCloseDatabase.Text = "Close Database"; + this.btnCloseDatabase.UseVisualStyleBackColor = true; + this.btnCloseDatabase.Click += new System.EventHandler(this.btnCloseDatabase_Click); + // + // btnOpenDatabase + // + this.btnOpenDatabase.Location = new System.Drawing.Point(28, 34); + this.btnOpenDatabase.Name = "btnOpenDatabase"; + this.btnOpenDatabase.Size = new System.Drawing.Size(150, 23); + this.btnOpenDatabase.TabIndex = 0; + this.btnOpenDatabase.Text = "Open Database"; + this.btnOpenDatabase.UseVisualStyleBackColor = true; + this.btnOpenDatabase.Click += new System.EventHandler(this.btnOpenDatabase_Click); + // + // grpEvents + // + this.grpEvents.Controls.Add(this.edEvent); + this.grpEvents.Controls.Add(this.label1); + this.grpEvents.Controls.Add(this.btnGenerateEvent); + this.grpEvents.Enabled = false; + this.grpEvents.Location = new System.Drawing.Point(238, 15); + this.grpEvents.Name = "grpEvents"; + this.grpEvents.Size = new System.Drawing.Size(200, 100); + this.grpEvents.TabIndex = 1; + this.grpEvents.TabStop = false; + this.grpEvents.Text = "Generate Events"; + // + // edEvent + // + this.edEvent.Location = new System.Drawing.Point(56, 27); + this.edEvent.Name = "edEvent"; + this.edEvent.Size = new System.Drawing.Size(123, 23); + this.edEvent.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(8, 31); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(36, 15); + this.label1.TabIndex = 2; + this.label1.Text = "Event"; + // + // btnGenerateEvent + // + this.btnGenerateEvent.Enabled = false; + this.btnGenerateEvent.Location = new System.Drawing.Point(26, 63); + this.btnGenerateEvent.Name = "btnGenerateEvent"; + this.btnGenerateEvent.Size = new System.Drawing.Size(153, 23); + this.btnGenerateEvent.TabIndex = 1; + this.btnGenerateEvent.Text = "Generate Event"; + this.btnGenerateEvent.UseVisualStyleBackColor = true; + this.btnGenerateEvent.Click += new System.EventHandler(this.btnGenerateEvent_Click); + // + // grpRegistration + // + this.grpRegistration.Controls.Add(this.moRegister); + this.grpRegistration.Controls.Add(this.btnRegisterEvents); + this.grpRegistration.Enabled = false; + this.grpRegistration.Location = new System.Drawing.Point(28, 136); + this.grpRegistration.Name = "grpRegistration"; + this.grpRegistration.Size = new System.Drawing.Size(200, 180); + this.grpRegistration.TabIndex = 2; + this.grpRegistration.TabStop = false; + this.grpRegistration.Text = "Event Registration"; + // + // moRegister + // + this.moRegister.Location = new System.Drawing.Point(6, 25); + this.moRegister.Multiline = true; + this.moRegister.Name = "moRegister"; + this.moRegister.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.moRegister.Size = new System.Drawing.Size(188, 121); + this.moRegister.TabIndex = 0; + this.moRegister.Text = "aa\r\nbb\r\n1\r\n2\r\n3\r\n4\r\n5\r\n6\r\n7\r\n8\r\n9\r\n10\r\n11\r\n12\r\n13"; + // + // btnRegisterEvents + // + this.btnRegisterEvents.Enabled = false; + this.btnRegisterEvents.Location = new System.Drawing.Point(28, 152); + this.btnRegisterEvents.Name = "btnRegisterEvents"; + this.btnRegisterEvents.Size = new System.Drawing.Size(150, 22); + this.btnRegisterEvents.TabIndex = 1; + this.btnRegisterEvents.Text = "Register Events"; + this.btnRegisterEvents.UseVisualStyleBackColor = true; + this.btnRegisterEvents.Click += new System.EventHandler(this.btnRegisterEvents_Click); + // + // grpReceived + // + this.grpReceived.Controls.Add(this.lbReceived); + this.grpReceived.Controls.Add(this.btnClearEventsReceived); + this.grpReceived.Enabled = false; + this.grpReceived.Location = new System.Drawing.Point(238, 136); + this.grpReceived.Name = "grpReceived"; + this.grpReceived.Size = new System.Drawing.Size(200, 180); + this.grpReceived.TabIndex = 3; + this.grpReceived.TabStop = false; + this.grpReceived.Text = "Event Received"; + // + // lbReceived + // + this.lbReceived.FormattingEnabled = true; + this.lbReceived.ItemHeight = 15; + this.lbReceived.Location = new System.Drawing.Point(8, 22); + this.lbReceived.Name = "lbReceived"; + this.lbReceived.Size = new System.Drawing.Size(182, 124); + this.lbReceived.TabIndex = 0; + // + // btnClearEventsReceived + // + this.btnClearEventsReceived.Enabled = false; + this.btnClearEventsReceived.Location = new System.Drawing.Point(26, 151); + this.btnClearEventsReceived.Name = "btnClearEventsReceived"; + this.btnClearEventsReceived.Size = new System.Drawing.Size(153, 23); + this.btnClearEventsReceived.TabIndex = 1; + this.btnClearEventsReceived.Text = "Clear Events Received"; + this.btnClearEventsReceived.UseVisualStyleBackColor = true; + this.btnClearEventsReceived.Click += new System.EventHandler(this.btnClearEventsReceived_Click); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(460, 343); + this.Controls.Add(this.grpReceived); + this.Controls.Add(this.grpRegistration); + this.Controls.Add(this.grpEvents); + this.Controls.Add(this.grpConnection); + this.Name = "MainForm"; + this.Text = "Event Alerter Demo"; + this.grpConnection.ResumeLayout(false); + this.grpEvents.ResumeLayout(false); + this.grpEvents.PerformLayout(); + this.grpRegistration.ResumeLayout(false); + this.grpRegistration.PerformLayout(); + this.grpReceived.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private GroupBox grpConnection; + private GroupBox grpEvents; + private GroupBox grpRegistration; + private GroupBox grpReceived; + private Button btnCloseDatabase; + private Button btnOpenDatabase; + private Button btnGenerateEvent; + private Button btnRegisterEvents; + private Button btnClearEventsReceived; + private TextBox moRegister; + private ListBox lbReceived; + private TextBox edEvent; + private Label label1; + } +} \ No newline at end of file diff --git a/NETProvider/Demos/EventDemo/MainForm.cs b/NETProvider/Demos/EventDemo/MainForm.cs new file mode 100644 index 0000000..1e2e74b --- /dev/null +++ b/NETProvider/Demos/EventDemo/MainForm.cs @@ -0,0 +1,153 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * https://github.com/Embarcadero/IB.NETDataProvider/blob/main/LICENSE. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Initial Developer(s) of the Original Code are listed below. + * Portions created by Embarcadero are Copyright (C) Embarcadero. + * + * All Rights Reserved. + */ + +//$Authors = Embarcadero, Jeff Overcash + +using InterBaseSql.Data.InterBaseClient; +using System.IO; +using InterBaseSql.Data.Common; + +namespace EventDemo +{ + public partial class MainForm : Form + { + private IBConnection _connection; + private IBEvents _events; + + public MainForm() + { + InitializeComponent(); + _connection = new IBConnection(); + _events = new IBEvents(); + _events.Connection = _connection; + _events.EventAlert += EventFired; + } + + private void btnOpenDatabase_Click(object sender, EventArgs e) + { + CreateAndConnectDatabase(); + btnOpenDatabase.Enabled = false; + btnClearEventsReceived.Enabled = true; + btnCloseDatabase.Enabled = true; + btnGenerateEvent.Enabled = true; + btnRegisterEvents.Enabled = true; + grpEvents.Enabled = true; + grpReceived.Enabled = true; + grpRegistration.Enabled = true; + } + + private static IBConnectionStringBuilder BuildConnectionStringBuilder() + { + var builder = new IBConnectionStringBuilder(); + builder.UserID = "SYSDBA"; + builder.Password = "masterkey"; + builder.DataSource = "localhost"; + builder.Database = AppDomain.CurrentDomain.BaseDirectory + "EventsDemo.ib"; + builder.Port = 3050; + return builder; + } + + private void CreateAndConnectDatabase() + { + var cs = BuildConnectionStringBuilder().ToString(); + if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "EventsDemo.ib")) + { + IBConnection.CreateDatabase(cs, 8192, true, true); + ConnectToDB(); + CreateSP(); + } + else + { + ConnectToDB(); + } + + void ConnectToDB() + + { + _connection.ConnectionString = cs; + _connection.Open(); + } + + void CreateSP() + { + using (var command = new IBCommand(@"CREATE PROCEDURE EVENTDEMO + ( + EVENT VARCHAR(40) + ) + AS + begin + post_event :event; + end", _connection)) + { + command.ExecuteNonQuery(); + } + } + } + + private void btnCloseDatabase_Click(object sender, EventArgs e) + { + if (_events.Registered) + _events.UnRegisterEvents(); + _connection!.Close(); + btnOpenDatabase.Enabled = true; + btnClearEventsReceived.Enabled = false; + btnCloseDatabase.Enabled = false; + btnGenerateEvent.Enabled = false; + btnRegisterEvents.Enabled = false; + grpEvents.Enabled = false; + grpReceived.Enabled = false; + grpRegistration.Enabled = false; + } + + private void EventFired(object sender, EventAlertArgs e) + { + if (e.Count == 1) + lbReceived.Items.Add(e.EventName); + else + lbReceived.Items.Add(e.EventName + "(" + e.Count.ToString() + ")"); + } + + private void btnRegisterEvents_Click(object sender, EventArgs e) + { + _events.UnRegisterEvents(); + try + { + _events.Events = new List(moRegister.Text.Split(Environment.NewLine)); + } + catch (InvalidOperationException ex) + { + MessageBox.Show(ex.Message); + } + _events.RegisterEvents(); + } + + private void btnGenerateEvent_Click(object sender, EventArgs e) + { + var command = new IBCommand("execute procedure eventdemo(?)", _connection); + command.CommandType = System.Data.CommandType.StoredProcedure; + command.Parameters.Add("@Event", IBDbType.VarChar).Direction = System.Data.ParameterDirection.Input; + command.Parameters[0].Value = edEvent.Text; + command.ExecuteNonQuery(); + } + + private void btnClearEventsReceived_Click(object sender, EventArgs e) + { + lbReceived.Items.Clear(); + } + } +} \ No newline at end of file diff --git a/NETProvider/Demos/EventDemo/MainForm.resx b/NETProvider/Demos/EventDemo/MainForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/NETProvider/Demos/EventDemo/MainForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NETProvider/Demos/EventDemo/Program.cs b/NETProvider/Demos/EventDemo/Program.cs new file mode 100644 index 0000000..94c2d83 --- /dev/null +++ b/NETProvider/Demos/EventDemo/Program.cs @@ -0,0 +1,17 @@ +namespace EventDemo +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new MainForm()); + } + } +} \ No newline at end of file diff --git a/NETProvider/Provider/build.ps1 b/NETProvider/Provider/build.ps1 index c6014d8..2f4ed79 100644 --- a/NETProvider/Provider/build.ps1 +++ b/NETProvider/Provider/build.ps1 @@ -47,6 +47,7 @@ function Pack() { 7z a -mx=9 -bsp0 $outDir\InterBaseSql.Data.InterBaseClient-$version-net452.7z $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net452\InterBaseSql.Data.InterBaseClient.dll $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net452\InterBaseSql.Data.InterBaseClient.pdb 7z a -mx=9 -bsp0 $outDir\InterBaseSql.Data.InterBaseClient-$version-netstandard2.0.7z $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\netstandard2.0\InterBaseSql.Data.InterBaseClient.dll $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\netstandard2.0\InterBaseSql.Data.InterBaseClient.pdb 7z a -mx=9 -bsp0 $outDir\InterBaseSql.Data.InterBaseClient-$version-net5.0.7z $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net5.0\InterBaseSql.Data.InterBaseClient.dll $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net5.0\InterBaseSql.Data.InterBaseClient.pdb + 7z a -mx=9 -bsp0 $outDir\InterBaseSql.Data.InterBaseClient-$version-net6.0.7z $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net6.0\InterBaseSql.Data.InterBaseClient.dll $baseDir\src\InterBaseSql.Data.InterBaseClient\bin\$Configuration\net6.0\InterBaseSql.Data.InterBaseClient.pdb 7z a -mx=9 -bsp0 $outDir\EntityFramework.InterBase-$version-net452.7z $baseDir\src\EntityFramework.InterBase\bin\$Configuration\net452\EntityFramework.InterBase.dll $baseDir\src\EntityFramework.InterBase\bin\$Configuration\net452\EntityFramework.InterBase.pdb 7z a -mx=9 -bsp0 $outDir\EntityFramework.InterBase-$version-netstandard2.1.7z $baseDir\src\EntityFramework.InterBase\bin\$Configuration\netstandard2.1\EntityFramework.InterBase.dll $baseDir\src\EntityFramework.InterBase\bin\$Configuration\netstandard2.1\EntityFramework.InterBase.pdb diff --git a/NETProvider/Provider/docs/ADO Driver documentation.docx b/NETProvider/Provider/docs/ADO Driver documentation.docx index 4092aad..7f6bfa0 100644 Binary files a/NETProvider/Provider/docs/ADO Driver documentation.docx and b/NETProvider/Provider/docs/ADO Driver documentation.docx differ diff --git a/NETProvider/Provider/installer/Installer.wxs b/NETProvider/Provider/installer/Installer.wxs index 7f82512..845257e 100644 --- a/NETProvider/Provider/installer/Installer.wxs +++ b/NETProvider/Provider/installer/Installer.wxs @@ -14,6 +14,7 @@ + @@ -123,6 +124,17 @@ + + + + + + + + + + + diff --git a/NETProvider/Provider/src/Directory.Build.props b/NETProvider/Provider/src/Directory.Build.props index 4449ef3..776b0a5 100644 --- a/NETProvider/Provider/src/Directory.Build.props +++ b/NETProvider/Provider/src/Directory.Build.props @@ -5,7 +5,7 @@ portable - 7.11.0 + 7.12.1 Embarcadero NETProvider @@ -21,15 +21,5 @@ license.txt - - - true - true - - - - all - runtime; build; native; contentfiles; analyzers - - + \ No newline at end of file diff --git a/NETProvider/Provider/src/EntityFramework.InterBase/EntityFramework.InterBase.csproj b/NETProvider/Provider/src/EntityFramework.InterBase/EntityFramework.InterBase.csproj index 08a3a60..d99c897 100644 --- a/NETProvider/Provider/src/EntityFramework.InterBase/EntityFramework.InterBase.csproj +++ b/NETProvider/Provider/src/EntityFramework.InterBase/EntityFramework.InterBase.csproj @@ -10,7 +10,7 @@ NETProvider - Entity Framework Provider - (c) 2014-2021 + (c) 2014-2022 EntityFramework.InterBase diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ChangeViewTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ChangeViewTests.cs index dd525a5..4e55e82 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ChangeViewTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ChangeViewTests.cs @@ -209,7 +209,6 @@ public void ChangeDelete() cmd.CommandText = "select * from employee order by emp_no"; var reader = cmd.ExecuteReader(); - int i; int j = 0; while (reader.Read()) { @@ -230,7 +229,6 @@ public void ChangeInsert() cmd.CommandText = "select * from employee order by emp_no"; var reader = cmd.ExecuteReader(); - int i; int j = 0; while (reader.Read()) { diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/Changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/Changelog.md index 2af0d40..3329f4d 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/Changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/Changelog.md @@ -1,3 +1,25 @@ +# Changes for 7.12.1 + +## ChangeViewTests.cs +* Cleaned up a few unused variable warnings + +## ConnectionStringTests.cs +* Added ParsingDatabaseHostnamesWithPort to test parsing port out of the Database property +* Added ParsingServerHostnamesWithPort to test the new support for passing the server/port/ through the server instead of the Database property + +## IBArrayTests.cs and IBBlobTests.cs +* IFDEF for NET60 and greater to switch to a different way to generate random numbers + +## IBConnectionStringBuilderTests.cs +* Added CharacterSetDefault to test that no passed CharSet is None, not UTF8 + +## IBEventTests.cs (new) +* Added test for registering events +* In general it is easier to test events with demos than a unit test unfortunately. + +## InterbaseSQL.Data.InterBaseClient.Tests.csproj +* Updated to include NET60 as a target platform + # Changes for 7.11.0 ## ChangeViewTests.cs (new) diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ConnectionStringTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ConnectionStringTests.cs index 80ada8a..0aabbd7 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ConnectionStringTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/ConnectionStringTests.cs @@ -760,5 +760,33 @@ public void ParsingDatabaseHostnames(string hostname) Assert.AreEqual(hostname, cs.DataSource); Assert.AreEqual("test.ib", cs.Database); } + + [Test] + public void ParsingDatabaseHostnamesWithPort() + { + var ConnectionString = $"database=localhost/3050:;user=TEXDBA;password=texdba;port=3050;charset=None;"; + var cs = new ConnectionString(ConnectionString); + cs.Validate(); + Assert.AreEqual("localhost", cs.DataSource); + Assert.AreEqual("", cs.Database); + Assert.AreEqual(3050, cs.Port); + Assert.AreEqual("TEXDBA", cs.UserID); + Assert.AreEqual("texdba", cs.Password); + Assert.AreEqual("None", cs.Charset); + } + + [Test] + public void ParsingServerHostnamesWithPort() + { + var ConnectionString = $"Server=localhost/3050:;user=TEXDBA;password=texdba;port=3050;charset=None;"; + var cs = new ConnectionString(ConnectionString); + cs.Validate(); + Assert.AreEqual("localhost", cs.DataSource); + Assert.AreEqual("", cs.Database); + Assert.AreEqual(3050, cs.Port); + Assert.AreEqual("TEXDBA", cs.UserID); + Assert.AreEqual("texdba", cs.Password); + Assert.AreEqual("None", cs.Charset); + } } } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBArrayTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBArrayTests.cs index 53ec446..f16fd40 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBArrayTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBArrayTests.cs @@ -704,9 +704,13 @@ public void BigArrayTest() var selectText = "SELECT big_array FROM TEST WHERE int_field = " + id_value.ToString(); var insertText = "INSERT INTO TEST (int_field, big_array) values(@int_field, @array_field)"; + #if NET6_0_OR_GREATER + byte[] bytes = RandomNumberGenerator.GetBytes(elements * 4); + #else var bytes = new byte[elements * 4]; var rng = new RNGCryptoServiceProvider(); rng.GetBytes(bytes); + #endif var insert_values = new int[elements]; Buffer.BlockCopy(bytes, 0, insert_values, 0, bytes.Length); @@ -746,9 +750,13 @@ public void PartialUpdatesTest() var selectText = "SELECT big_array FROM TEST WHERE int_field = " + id_value.ToString(); var insertText = "INSERT INTO TEST (int_field, big_array) values(@int_field, @array_field)"; + #if NET6_0_OR_GREATER + byte[] bytes = RandomNumberGenerator.GetBytes(elements * 4); + #else var bytes = new byte[elements * 4]; var rng = new RNGCryptoServiceProvider(); rng.GetBytes(bytes); + #endif var insert_values = new int[elements]; Buffer.BlockCopy(bytes, 0, insert_values, 0, bytes.Length); @@ -777,6 +785,6 @@ public void PartialUpdatesTest() select.Dispose(); } - #endregion +#endregion } } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBBlobTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBBlobTests.cs index 33f373b..0683187 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBBlobTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBBlobTests.cs @@ -47,9 +47,13 @@ public void BinaryBlobTest() var insertText = "INSERT INTO TEST (int_field, blob_field) values(@int_field, @blob_field)"; // Generate an array of temp data + #if NET6_0_OR_GREATER + byte[] insert_values = RandomNumberGenerator.GetBytes(100000 * 4); + #else var insert_values = new byte[100000 * 4]; var rng = new RNGCryptoServiceProvider(); rng.GetBytes(insert_values); + #endif // Execute insert command var transaction = Connection.BeginTransaction(); @@ -83,9 +87,13 @@ public void ReaderGetBytes() var insertText = "INSERT INTO TEST (int_field, blob_field) values(@int_field, @blob_field)"; // Generate an array of temp data + #if NET6_0_OR_GREATER + byte[] insert_values = RandomNumberGenerator.GetBytes(100000 * 4); + #else var insert_values = new byte[100000 * 4]; var rng = new RNGCryptoServiceProvider(); rng.GetBytes(insert_values); + #endif // Execute insert command var transaction = Connection.BeginTransaction(); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBConnectionStringBuilderTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBConnectionStringBuilderTests.cs index f1cf80c..9f0067b 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBConnectionStringBuilderTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBConnectionStringBuilderTests.cs @@ -40,5 +40,12 @@ public void NoValueProvidedReturnsDefault() Assert.AreEqual(b.MaxPoolSize, ConnectionString.DefaultValueMaxPoolSize); } + [Test] + public void CharacterSetDefault() + { + var b = new IBConnectionStringBuilder(); + Assert.AreEqual(b.Charset, "None"); + } + } } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBDataReaderTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBDataReaderTests.cs index 07ac2c0..a745c7c 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBDataReaderTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBDataReaderTests.cs @@ -33,7 +33,7 @@ public static class Extensions /// The Guid Constructor (UInt32, UInt16, UInt16, Byte, Byte, Byte, Byte, /// Byte, Byte, Byte, Byte) is not CLSCompliant. /// - [CLSCompliant(true)] +// [CLSCompliant(true)] public static Guid FlipEndian(this Guid guid) { var newBytes = new byte[16]; diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBEventTests.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBEventTests.cs new file mode 100644 index 0000000..8ff907f --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/IBEventTests.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Data; +using InterBaseSql.Data.TestsBase; +using NUnit.Framework; + +namespace InterBaseSql.Data.InterBaseClient.Tests +{ + [TestFixtureSource(typeof(IBDefaultServerTypeTestFixtureSource))] + [TestFixtureSource(typeof(IBEmbeddedServerTypeTestFixtureSource))] + public class IBEventTests : IBTestsBase + { + #region Constructors + + public IBEventTests(IBServerType serverType) + : base(serverType) + { } + + #endregion + + [Test] + public void RegisterEvents() + { + var list = new List { "1", "22" }; + var events = new IBEvents(); + events.Events = list; + events.RegisterEvents(); + } + + + } + +} diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/InterBaseSql.Data.InterBaseClient.Tests.csproj b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/InterBaseSql.Data.InterBaseClient.Tests.csproj index 99dd82a..d4551da 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/InterBaseSql.Data.InterBaseClient.Tests.csproj +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient.Tests/InterBaseSql.Data.InterBaseClient.Tests.csproj @@ -1,6 +1,6 @@  - net5.0;net452;netcoreapp3.1 + net452;netcoreapp3.1;net50;net60 false false true @@ -20,8 +20,10 @@ - - + + + + diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Changelog.md index b805620..5dc59e0 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Changelog.md @@ -1,3 +1,6 @@ +# Changes for 7.12.1 +* Added net60 target for the assembly + # Changes for 7.10.2 ## Removed Types folder completely diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/Changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/Changelog.md index 57b3fdb..ea619fd 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/Changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/Changelog.md @@ -1,3 +1,15 @@ +# Changes for 7.12.1 + +## IBServiceManager.cs +* Added support to connect to remote servers + +## IIBClient.cs +* Added delegate for the cdecl callback for events +* Fixed the signatures around events + +## LinuxClient.cs and WindowsClient.cs +* Fixed the Event signatures to match IIBClient.cs + # Changes for 7.11.0 ***Change View support added*** @@ -6,7 +18,7 @@ * Fixed null flag check to check >= 0 instead of != -1 ## IBDatabase.cs -* Added support for hte new truncate char feature. When true Char fields are right truncated +* Added support for the new truncate char feature. When true Char fields are right truncated # Changes for 7.10.2 diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IBServiceManager.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IBServiceManager.cs index d42fdc3..61fe7dc 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IBServiceManager.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IBServiceManager.cs @@ -89,11 +89,15 @@ public void Attach(ServiceParameterBuffer spb, string dataSource, int port, stri ClearStatusVector(); var svcHandle = HandlePtr; - + string Service; + if ((port > 0) || (dataSource != "")) + Service = dataSource + ((port > 0) ? "/" + port.ToString() : "") + ":" + service; + else + Service = service; _ibClient.isc_service_attach( _statusVector, - (short)service.Length, - service, + (short)Service.Length, + Service, ref svcHandle, spb.Length, spb.ToArray()); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IIBClient.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IIBClient.cs index 7fea01c..ddf0e16 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IIBClient.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/IIBClient.cs @@ -31,6 +31,10 @@ namespace InterBaseSql.Data.Client.Native /// IIBClient and IBClientactory classes are implemented to support this feature. /// Public visibility added, because auto-generated assembly can't work with internal types /// + /// + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ibEventCallbackDelegate(IntPtr p, short Length, IntPtr updated); + public interface IIBClient { #pragma warning disable IDE1006 @@ -355,12 +359,6 @@ IntPtr isc_blob_set_desc2( short segment_size, IntPtr descriptor); - IntPtr isc_cancel_events( - [In, Out] IntPtr[] statusVector, - [MarshalAs(UnmanagedType.I4)] ref DatabaseHandle dbHandle, - ref long eventID - ); - void isc_decode_date( ref long ibDate, [MarshalAs(UnmanagedType.Struct)] ref CTimeStructure tmDate); @@ -483,19 +481,34 @@ void isc_encode_timestamp( ref long ibDate, [MarshalAs(UnmanagedType.Struct)] ref CTimeStructure tmDate); - IntPtr isc_event_block( - byte[][] event_buffer, - byte[][] result_buffer, - short id_count, + IntPtr isc_cancel_events( + [In, Out] IntPtr[] statusVector, + [MarshalAs(UnmanagedType.I4)] ref DatabaseHandle dbHandle, + ref int eventID + ); + + IntPtr isc_que_events( + [In, Out] IntPtr[] statusVector, + [MarshalAs(UnmanagedType.I4)] ref DatabaseHandle dbHandle, + ref int eventId, + short length, + IntPtr eventBuffer, + ibEventCallbackDelegate eventFunction, + IntPtr eventFunctionArg); + + int isc_event_block( + ref IntPtr event_buffer, + ref IntPtr result_buffer, + ushort id_count, byte[][] event_list); void isc_event_counts( - ulong[] statusVector, + [In, Out] uint[] status, short bufferLength, - byte[] eventBuffer, - byte[] resultBuffer); + IntPtr eventBuffer, + IntPtr resultBuffer); - long isc_free(byte[] isc_arg1); + long isc_free(IntPtr isc_arg1); IntPtr isc_get_segment( [In, Out] IntPtr[] statusVector, @@ -517,15 +530,6 @@ IntPtr isc_prepare_transaction2( short msgLength, byte[] msg); - IntPtr isc_que_events( - [In, Out] IntPtr[] statusVector, - [MarshalAs(UnmanagedType.I4)] ref DatabaseHandle dbHandle, - ref long eventId, - short length, - byte[] eventBuffer, - IntPtr eventFunction, - IntPtr eventFunctionArg); - IntPtr isc_release_savepoint( [In, Out] IntPtr[] statusVector, [MarshalAs(UnmanagedType.I4)] ref TransactionHandle trHandle, diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/LinuxClient.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/LinuxClient.cs index 7892ed4..4aa4b1c 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/LinuxClient.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/LinuxClient.cs @@ -345,30 +345,31 @@ internal delegate IntPtr Tisc_rollback_retaining( internal delegate IntPtr Tisc_cancel_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventID); + ref int eventID); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate IntPtr Tisc_que_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventId, + ref int eventId, short length, - byte[] eventBuffer, - IntPtr eventFunction, + IntPtr eventBuffer, + ibEventCallbackDelegate eventFunction, IntPtr eventFunctionArg); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate void Tisc_event_counts( - ulong[] statusVector, + [In, Out] uint[] status, short bufferLength, - byte[] eventBuffer, - byte[] resultBuffer); + IntPtr eventBuffer, + IntPtr resultBuffer); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate IntPtr Tisc_event_block( - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] event_buffer, - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] result_buffer, - short id_count, - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] event_list); + internal delegate int Tisc_event_block( + ref IntPtr event_buffer, + ref IntPtr result_buffer, + ushort id_count, + byte[] v1, byte[] v2, byte[] v3, byte[] v4, byte[] v5, byte[] v6, byte[] v7, + byte[] v8, byte[] v9, byte[] v10, byte[] v11, byte[] v12, byte[] v13, byte[] v14, byte[] v15); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate long Tisc_free(byte[] isc_arg1); + internal delegate long Tisc_free(IntPtr isc_arg1); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] internal delegate IntPtr Tisc_prepare_transaction([In, Out] IntPtr[] statusVector, ref TransactionHandle trHandle); @@ -1329,7 +1330,7 @@ public IntPtr isc_blob_set_desc2( public IntPtr isc_cancel_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventID) + ref int eventID) { return _isc_cancel_events(statusVector, ref dbHandle, ref eventID); } @@ -1464,25 +1465,27 @@ public void isc_encode_timestamp( _isc_encode_timestamp(ref ibDate, ref tmDate); } - public IntPtr isc_event_block( - byte[][] event_buffer, - byte[][] result_buffer, - short id_count, + public int isc_event_block( + ref IntPtr event_buffer, + ref IntPtr result_buffer, + ushort id_count, byte[][] event_list) { - return _isc_event_block(event_buffer, result_buffer, id_count, event_list); + return _isc_event_block(ref event_buffer, ref result_buffer, id_count, event_list[0], event_list[1], + event_list[2], event_list[3], event_list[4], event_list[5], event_list[6], event_list[7], event_list[8], + event_list[9], event_list[10], event_list[11], event_list[12], event_list[13], event_list[14]); } public void isc_event_counts( - ulong[] statusVector, + [In, Out] uint[] status, short bufferLength, - byte[] eventBuffer, - byte[] resultBuffer) + IntPtr eventBuffer, + IntPtr resultBuffer) { - _isc_event_counts(statusVector, bufferLength, eventBuffer, resultBuffer); + _isc_event_counts(status, bufferLength, eventBuffer, resultBuffer); } - public long isc_free(byte[] isc_arg1) + public long isc_free(IntPtr isc_arg1) { return _isc_free(isc_arg1); } @@ -1512,10 +1515,10 @@ public IntPtr isc_prepare_transaction2( public IntPtr isc_que_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventId, + ref int eventId, short length, - byte[] eventBuffer, - IntPtr eventFunction, + IntPtr eventBuffer, + ibEventCallbackDelegate eventFunction, IntPtr eventFunctionArg) { return _isc_que_events(statusVector, ref dbHandle, ref eventId, length, eventBuffer, eventFunction, eventFunctionArg); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/WindowsClient.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/WindowsClient.cs index df414e9..c961fbc 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/WindowsClient.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Client/Native/WindowsClient.cs @@ -293,27 +293,28 @@ internal delegate IntPtr Tisc_rollback_retaining( internal delegate IntPtr Tisc_cancel_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventID); + ref int eventID); internal delegate IntPtr Tisc_que_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventId, + ref int eventId, short length, - byte[] eventBuffer, - IntPtr eventFunction, + IntPtr eventBuffer, + ibEventCallbackDelegate eventFunction, IntPtr eventFunctionArg); internal delegate void Tisc_event_counts( - ulong[] statusVector, + [In, Out] uint[] status, short bufferLength, - byte[] eventBuffer, - byte[] resultBuffer); + IntPtr eventBuffer, + IntPtr resultBuffer); [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - internal delegate IntPtr Tisc_event_block( - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] event_buffer, - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] result_buffer, - short id_count, - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(JaggedArrayMarshaler))] byte[][] event_list); - internal delegate long Tisc_free(byte[] isc_arg1); + internal delegate int Tisc_event_block( + ref IntPtr event_buffer, + ref IntPtr result_buffer, + ushort id_count, + byte[] v1, byte[] v2, byte[] v3, byte[] v4, byte[] v5, byte[] v6, byte[] v7, + byte[] v8, byte[] v9, byte[] v10, byte[] v11, byte[] v12, byte[] v13, byte[] v14, byte[] v15); + internal delegate long Tisc_free(IntPtr isc_arg1); internal delegate IntPtr Tisc_prepare_transaction([In, Out] IntPtr[] statusVector, ref TransactionHandle trHandle); internal delegate IntPtr Tisc_prepare_transaction2( @@ -1239,7 +1240,7 @@ public IntPtr isc_blob_set_desc2( public IntPtr isc_cancel_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventID) + ref int eventID) { return _isc_cancel_events(statusVector, ref dbHandle, ref eventID); } @@ -1374,25 +1375,27 @@ public void isc_encode_timestamp( _isc_encode_timestamp(ref ibDate, ref tmDate); } - public IntPtr isc_event_block( - byte[][] event_buffer, - byte[][] result_buffer, - short id_count, + public int isc_event_block( + ref IntPtr event_buffer, + ref IntPtr result_buffer, + ushort id_count, byte[][] event_list) { - return _isc_event_block(event_buffer, result_buffer, id_count, event_list); + return _isc_event_block(ref event_buffer, ref result_buffer, id_count, event_list[0], event_list[1], + event_list[2], event_list[3], event_list[4], event_list[5], event_list[6], event_list[7], event_list[8], + event_list[9], event_list[10], event_list[11], event_list[12], event_list[13], event_list[14]); } public void isc_event_counts( - ulong[] statusVector, + [In, Out] uint[] status, short bufferLength, - byte[] eventBuffer, - byte[] resultBuffer) + IntPtr eventBuffer, + IntPtr resultBuffer) { - _isc_event_counts(statusVector, bufferLength, eventBuffer, resultBuffer); + _isc_event_counts(status, bufferLength, eventBuffer, resultBuffer); } - public long isc_free(byte[] isc_arg1) + public long isc_free(IntPtr isc_arg1) { return _isc_free(isc_arg1); } @@ -1422,10 +1425,10 @@ public IntPtr isc_prepare_transaction2( public IntPtr isc_que_events( [In, Out] IntPtr[] statusVector, ref DatabaseHandle dbHandle, - ref long eventId, + ref int eventId, short length, - byte[] eventBuffer, - IntPtr eventFunction, + IntPtr eventBuffer, + ibEventCallbackDelegate eventFunction, IntPtr eventFunctionArg) { return _isc_que_events(statusVector, ref dbHandle, ref eventId, length, eventBuffer, eventFunction, eventFunctionArg); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Changelog.md index 2996da6..3c1643e 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Changelog.md @@ -1,3 +1,15 @@ +# Changes for 7.12.1 + +## ConnectionString +* Changed the default for CharSet from UTF8 to None +* Server/port information will now get parsed if only passed in the DataSource property. Database property still holds precedence + +## Extensions.cs +* suppressed a platform warning in TrySetKeepAlive. There does not seem to be a platform neutral version of this. + +## IDatabase.cs +* added a IBClient getter to be able to get at the underlying client library that a IBDatabase is using. + # Changes for 7.11.0 ***Change View support added*** diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/ConnectionString.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/ConnectionString.cs index df06751..25fc4c8 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/ConnectionString.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/ConnectionString.cs @@ -38,7 +38,7 @@ internal sealed class ConnectionString internal const string DefaultValuePassword = ""; internal const string DefaultValueRoleName = ""; internal const string DefaultValueCatalog = ""; - internal const string DefaultValueCharacterSet = "UTF8"; + internal const string DefaultValueCharacterSet = "None"; internal const int DefaultValueDialect = 3; internal const int DefaultValuePacketSize = 8192; internal const bool DefaultValuePooling = true; @@ -390,6 +390,11 @@ private void Load(string connectionString) { ParseConnectionInfo(Database); } + // See if it was passed through the server + if (string.IsNullOrEmpty(Database) && !string.IsNullOrEmpty(DataSource)) + { + ParseConnectionInfo(DataSource); + } } } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Extensions.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Extensions.cs index 3134c71..0a794dc 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Extensions.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/Extensions.cs @@ -70,7 +70,9 @@ public static bool TrySetKeepAlive(this Socket socket, ulong time, ulong interva return TrySocketAction(() => { socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, turnOn ? 1 : 0); +#pragma warning disable CA1416 socket.IOControl(IOControlCode.KeepAliveValues, inValue, outValue); +#pragma warning restore CA1416 }); } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/IDatabase.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/IDatabase.cs index 3982b9c..f7c2e0d 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/IDatabase.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Common/IDatabase.cs @@ -20,6 +20,7 @@ using System; using System.Collections.Generic; +using InterBaseSql.Data.Client.Native; namespace InterBaseSql.Data.Common { @@ -36,6 +37,7 @@ internal interface IDatabase bool HasRemoteEventSupport { get; } bool ConnectionBroken { get; } bool TruncateChar { get; set; } + public IIBClient IBClient { get; } void Attach(DatabaseParameterBuffer dpb, string database); void Detach(); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Embarcadero.Data.InterBaseClient.csproj b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Embarcadero.Data.InterBaseClient.csproj index 3431414..4d9b398 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Embarcadero.Data.InterBaseClient.csproj +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/Embarcadero.Data.InterBaseClient.csproj @@ -1,6 +1,6 @@  - net452;netstandard2.0;net5.0 + net452;netstandard2.0;net5.0;net6.0 InterBaseSql.Data.InterBaseClient InterBaseSql.Data true @@ -11,7 +11,7 @@ InterBase - ADO.NET Data Provider - (c) 2002-2021 + (c) 2002-2022 InterBaseSql.Data.InterBaseClient @@ -22,9 +22,9 @@ Embarcadero Embarcadero - 7.11.0.0 - 7.11.0.0 - 7.11.0 + 7.12.1.0 + 7.12.1.0 + 7.12.1 TRACE @@ -50,12 +50,12 @@ - - - + + + diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnection.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnection.cs index 7d3ae8f..b2facf2 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnection.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnection.cs @@ -164,6 +164,8 @@ public static void DropDatabase(string connectionString) #endregion + internal IDatabase IBDatabase => _innerConnection.Database; + #region Properties [Category("Data")] diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnectionInternal.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnectionInternal.cs index ed4209a..002232f 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnectionInternal.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBConnectionInternal.cs @@ -367,7 +367,7 @@ public void ReleasePreparedCommands() #endregion - #region Firebird Events Methods + #region InterBase Events Methods public void CloseEventManager() { diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEventThread.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEventThread.cs new file mode 100644 index 0000000..8a0fd02 --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEventThread.cs @@ -0,0 +1,300 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * https://github.com/Embarcadero/IB.NETDataProvider/blob/main/LICENSE. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Initial Developer(s) of the Original Code are listed below. + * Portions created by Embarcadero are Copyright (C) Embarcadero. + * + * All Rights Reserved. + */ + +//$Authors = Embarcadero, Jeff Overcash + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using InterBaseSql.Data.Client.Native; +using InterBaseSql.Data.Common; +using System.ComponentModel; + +namespace InterBaseSql.Data.InterBaseClient +{ + public class IBEventThread + { + internal class ProgressInfo + { + internal int WhichEvent { get; set; } + internal int Count { get; set; } + } + + internal const int MaxEventBlock = 15; + // API use + private int _eventID; + private IntPtr _eventBuffer; + private short _eventBufferLen; + private IntPtr _resultBuffer; + private IntPtr _thisCallback; + private uint[] _status; + private IntPtr[] _statusVector; + private static Dictionary _instance = new Dictionary(); + private static ibEventCallbackDelegate callback; + // local use + private BackgroundWorker _bgWorker; + private EventWaitHandle _signal; + private bool _eventsReceived, _firstTime; + private int _eventGroup; + private ushort _eventCount; + private IBEvents _parent; + private bool _cancelAlerts; + private bool _terminate = false; + + internal IIBClient IBClient => Parent.Connection.IBDatabase.IBClient; + + public IBEvents Parent + { + get { return _parent; } + set { _parent = value; } + } + + public EventWaitHandle Signal { get { return _signal; } } + + public bool ReturnValue { get; set; } + public bool HandleExceptions { get; set; } + + internal bool ThreadRunning { get { return !_terminate; } } + + public IBEventThread(IBEvents owner, int eventGrp) + { + _status = new uint[15]; + _eventGroup = eventGrp; + ReturnValue = false; + HandleExceptions = true; + _signal = new EventWaitHandle(false, EventResetMode.ManualReset); + _statusVector = new IntPtr[IscCodes.ISC_STATUS_LENGTH]; + callback = new ibEventCallbackDelegate(IBEventThread.EventCallback); + Parent = owner; + _bgWorker = new System.ComponentModel.BackgroundWorker(); + _bgWorker.WorkerReportsProgress = true; + _bgWorker.DoWork +=new DoWorkEventHandler(Execute); + _bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted); + _bgWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged); + _bgWorker.RunWorkerAsync(); + } + + ~IBEventThread() + { + _instance.Remove(_thisCallback); + } + + protected void Execute(object sender, DoWorkEventArgs e) + { + RegisterEvents(); + QueueEvents(); + try + { + do + { + Signal.WaitOne(); + if (_eventsReceived) + { + ProcessEvents(); + QueueEvents(); + } + } + while (!_terminate); + ReturnValue = false; + UnRegisterEvents(); + } + catch + { + if (HandleExceptions) + ReturnValue = true; + else + ReturnValue = false; + } + e.Result = ReturnValue; + } + + protected void SignalEvent() + { + _eventsReceived = true; + Signal.Set(); + } + + internal void SignalTerminate() + { + if (_terminate == false) + { + _terminate = true; + Signal.Set(); + } + } + + private byte[] EBP(int Index) + { + Index = Index + (_eventGroup * MaxEventBlock); + if (Index >= Parent.Events.Count) + return null; + else + return Encoding.ASCII.GetBytes(Parent.Events[Index]); + } + + protected void RegisterEvents() + { + var EBPArray = new Byte[MaxEventBlock][]; + _eventBuffer = IntPtr.Zero; + _resultBuffer = IntPtr.Zero; + _eventBufferLen = 0; + _firstTime = true; + _eventCount = (ushort) (Parent.Events.Count - (_eventGroup * MaxEventBlock)); + if (_eventCount > MaxEventBlock) + _eventCount = MaxEventBlock; + for ( var i = 0; i < MaxEventBlock; i++) + EBPArray[i] = EBP(i); + _eventBufferLen = (short) IBClient.isc_event_block(ref _eventBuffer, ref _resultBuffer, _eventCount, EBPArray); + } + + protected void UnRegisterEvents() + { + var handle = ((IBDatabase)Parent.Connection.IBDatabase).HandlePtr; + IBClient.isc_cancel_events(_statusVector, ref handle, ref _eventID); + IBClient.isc_free(_eventBuffer); + _eventBuffer = IntPtr.Zero; + IBClient.isc_free(_resultBuffer); + _resultBuffer = IntPtr.Zero; + } + + protected void QueueEvents() + { + _eventsReceived = false; + Signal.Reset(); + SQueEvents(); + } + + private static void EventCallback(IntPtr p, short Length, IntPtr updated) + { + if ((p != IntPtr.Zero) && (updated != IntPtr.Zero)) + { + IBEventThread iBEventThread = _instance[p]; + if (iBEventThread != null) + { + byte[] managedArray = new byte[Length]; + Marshal.Copy(updated, managedArray, 0, Length); + iBEventThread.UpdateResultBuffer(Length, managedArray); + iBEventThread._eventsReceived = true; + iBEventThread.Signal.Set(); + } + } + } + + protected void SQueEvents() + { + try + { + _instance.Remove(_thisCallback); + var handle = ((IBDatabase)Parent.Connection.IBDatabase).HandlePtr; + GCHandle handle1 = GCHandle.Alloc(this); + _thisCallback = GCHandle.ToIntPtr(handle1); + handle1.Free(); + _instance.Add(_thisCallback, this); + int status = (int) IBClient.isc_que_events(_statusVector, ref handle, ref _eventID, _eventBufferLen, _eventBuffer, callback, _thisCallback); + } + catch + { + /* on E: Exception do + if Assigned(Parent.OnError) then + + + if E is EIBError then + + Parent.OnError(Parent, EIBError(E).IBErrorCode) + + else + Parent.OnError(Parent, 0); + end;*/ + + } + } + + protected void ProcessEvents() + { + int _whichEvent, _countForEvent; + IBClient.isc_event_counts(_status, _eventBufferLen, _eventBuffer, _resultBuffer); + if (!_firstTime) + { + _cancelAlerts = false; + for (int i = 0; i < _eventCount; i++) + { + if (_status[i] != 0) + { + _whichEvent = i; + _countForEvent = (int)_status[_whichEvent]; + // This just forces the event into the main thread + _bgWorker.ReportProgress(0, new ProgressInfo() { WhichEvent = _whichEvent, Count = _countForEvent}); + } + } + } + _firstTime = false; + } + + private void backgroundWorker1_ProgressChanged(object sender, + ProgressChangedEventArgs e) + { + // 0 is for an event, 1 is for errors. This is used to get this into the main thread + if (e.ProgressPercentage == 0) + { + ProgressInfo pi = e.UserState as ProgressInfo; + var eventName = Parent.Events[((_eventGroup * MaxEventBlock) + pi.WhichEvent)]; + var args = new EventAlertArgs() { CancelAlerts = false, Count = pi.Count, EventName = eventName }; + Parent.OnEventAlert(args); + _cancelAlerts = args.CancelAlerts; + } + } + + private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + Parent._threads.Remove(this); + } + + protected void DoHandleException() + { + + } + + protected bool HandleException() + { +/* if (!Parent.ThreadException) + { + Parent.ThreadException = true; + if (FExceptObject is EAbort) + Parent.OnEventError; // need synchronizing? + return true; + } + else */ + return false; + } + + internal void UpdateResultBuffer(short length, byte[] Updated) + { + unsafe + { + Span byteArray = new Span(_resultBuffer.ToPointer(), length); + for (int i = 0; i < Updated.Length; i++) + { + byteArray[i] = Updated[i]; + } + } + } + } +} diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEvents.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEvents.cs new file mode 100644 index 0000000..2a4b28f --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBEvents.cs @@ -0,0 +1,172 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * https://github.com/Embarcadero/IB.NETDataProvider/blob/main/LICENSE. + * + * Software distributed under the License is distributed on + * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for the specific + * language governing rights and limitations under the License. + * + * The Initial Developer(s) of the Original Code are listed below. + * Portions created by Embarcadero are Copyright (C) Embarcadero. + * + * All Rights Reserved. + */ + +//$Authors = Embarcadero, Jeff Overcash + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Data; +using System.Threading; +using System.Runtime.InteropServices; +using InterBaseSql.Data.Common; +using InterBaseSql.Data.Client.Native; + + +namespace InterBaseSql.Data.InterBaseClient +{ + public class IBEvents + { + const int MaxEventNameLength = 255; + const int MaxEpbLength = 65535; + + private List _events; + internal List _threads; + private bool _registered; + + private IBConnection _connection; + + public IBConnection Connection + { + get { return _connection; } + set + { + if ((Registered) && (value != _connection)) + throw new InvalidOperationException("Unregister events before changing the connection"); + _connection = value; + } + } + + public List Events + { + get { return _events; } + set + { + if (value.Count > 15) + throw new InvalidOperationException("Events are currently restricted to a max 15"); + _events = value.ToList(); + } + } + + protected void ValidateDatabase() + { + if (_connection == null) + throw new InvalidOperationException("Connection not assigned."); + if (_connection.State != ConnectionState.Open) + throw new InvalidOperationException("Connection not open"); + } + + public bool Registered + { + get { return _registered; } + set + { + _registered = value; + if (value) + RegisterEvents(); + else + UnRegisterEvents(); + } + } + + public IBEvents() + { + _events = new List(); + _threads = new List(); + } + + ~IBEvents() + { + if (Registered) + UnRegisterEvents(); + } + + public void RegisterEvents() + { + if (!_registered) + { + for (int i = 0; i <= (_events.Count / IBEventThread.MaxEventBlock); i++) + { + _threads.Add(new IBEventThread(this, i)); + Thread.Sleep(100); + } + } + else + throw new InvalidOperationException("Unregister old events before registering new ones."); + _registered = _threads.Count != 0; + } + + public void UnRegisterEvents() + { + for (int i = _threads.Count - 1; i >= 0; i--) + { + IBEventThread t = _threads[i]; + t.SignalTerminate(); + while (t.ThreadRunning) + { + Thread.Sleep(100); + } + _threads.Remove(t); + } + _registered = _threads.Count != 0; + } + + internal virtual void OnEventAlert(EventAlertArgs e) + { + EventAlertHandler handler = EventAlert; + if (handler != null) + { + handler(this, e); + } + } + +/* internal virtual void OnEventError(EventErrorArgs e) + { + EventErrorHandler handler = EventError; + if (handler != null) + { + handler(this, e); + } + }*/ + + public event EventAlertHandler EventAlert; + +// public event EventErrorHandler EventError; + + } + + public delegate void EventAlertHandler(object sender, EventAlertArgs e); +// public delegate void EventErrorHandler(object sender, EventErrorArgs e); + + public class EventAlertArgs : EventArgs + { + public string EventName { get; set; } + + public int Count { get; set; } + + public bool CancelAlerts { get; set; } + } + +/* public class EventErrorArgs : EventArgs + { + public int ErrorCode { get; set; } + }*/ + +} diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBTransaction.cs b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBTransaction.cs index 1a9f3a3..b2ef7e3 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBTransaction.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/IBTransaction.cs @@ -151,7 +151,11 @@ public override void Rollback() #region Methods +#if NET5_0_OR_GREATER + public override void Save(string savePointName) +#else public void Save(string savePointName) +#endif { EnsureSavePointName(savePointName); EnsureCompleted(); @@ -185,7 +189,11 @@ public void Commit(string savePointName) } } +#if NET5_0_OR_GREATER + public override void Rollback(string savePointName) +#else public void Rollback(string savePointName) +#endif { EnsureSavePointName(savePointName); EnsureCompleted(); diff --git a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/changelog.md index 8176dc8..133177a 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.InterBaseClient/InterBaseClient/changelog.md @@ -1,3 +1,21 @@ +# Changes for 7.12.1 + +## IBConnection.cs +* Support to get at the IDatabase to the inner connection + +## IBConnectionInternal.cs +* Fixed a comment still referring to Firebird to InterBase + +## IBEvents.cs +* New public class for handling InterBase Events + +## IBEventThread.cs +* New internal class for background threading of InterBase Events + +## IBTransaction.cs +* IFDEF to override Save method for save points when compiled for NET50 or higher +* IFDEF to override Rollback method for save points when compiled for NET50 or higher + # Changes for 7.11.0 ***Change View support added*** diff --git a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/Changelog.md b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/Changelog.md index aff0d69..703ff71 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/Changelog.md +++ b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/Changelog.md @@ -1,3 +1,11 @@ +# Changes for 7.12.1 + +## IBTestsBase.cs +* Updated the way random numbers generated in NET60 and up + +## IBTestsSetup +* Added a SP for events in the DB install setup + # Changes for 7.11.0 ## IBTestsBase.cs diff --git a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsBase.cs b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsBase.cs index dc51740..037099b 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsBase.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsBase.cs @@ -341,9 +341,13 @@ protected bool EnsureServerType(IBServerType type) protected static int GetId() { + #if NET6_0_OR_GREATER + byte[] buffer = RandomNumberGenerator.GetBytes(4); + #else var rng = new RNGCryptoServiceProvider(); var buffer = new byte[4]; rng.GetBytes(buffer); + #endif return BitConverter.ToInt32(buffer, 0); } diff --git a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsSetup.cs b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsSetup.cs index 6e2b65d..bf06ec9 100644 --- a/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsSetup.cs +++ b/NETProvider/Provider/src/InterBaseSql.Data.TestsBase/IBTestsSetup.cs @@ -549,6 +549,21 @@ private static void CreateProcedures(string connectionString) command.ExecuteNonQuery(); } + commandText.Clear(); + commandText.Append("create PROCEDURE EVENTTEST\r\n"); + commandText.Append("(\r\n"); + commandText.Append(" EVENT VARCHAR(40)\r\n"); + commandText.Append(")\r\n"); + commandText.Append("AS\r\n"); + commandText.Append("declare variable RELNAME VARCHAR(68);\r\n"); + commandText.Append("begin\r\n"); + commandText.Append(" post_event :event;\r\n"); + commandText.Append("end\r\n"); + using (var command = new IBCommand(commandText.ToString(), connection)) + { + command.ExecuteNonQuery(); + } + using (var command = new IBCommand("", connection)) { command.CommandText = @" diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/Changelog.md b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/Changelog.md new file mode 100644 index 0000000..e8695eb --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/Changelog.md @@ -0,0 +1,18 @@ +#Changes for 7.12.1 + +## IBTestStore.cs +* Added the path to the DB name to place the DB in the same directory as the running test. + +# Changes for 7.10.2 + +## General - +* All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. + +## Common +* Namespaces changed from FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests to InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests +* Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. + +* All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. +* For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup + +* using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities now using InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests.TestUtilities diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/Changelog.txt deleted file mode 100644 index 20f0999..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/Changelog.txt +++ /dev/null @@ -1,13 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - Namespaces changed from FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities to InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests.TestUtilities - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - using FirebirdSql.Data.FirebirdClient now using InterBaseSql.Data.InterBaseClient \ No newline at end of file diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/IBTestStore.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/IBTestStore.cs index 936f36e..a58c1db 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/IBTestStore.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.FunctionalTests/TestUtilities/IBTestStore.cs @@ -36,9 +36,10 @@ public static IBTestStore GetOrCreate(string name) public IBTestStore(string name, bool shared) : base(name, shared) { + var path = AppDomain.CurrentDomain.BaseDirectory; var csb = new IBConnectionStringBuilder { - Database = $"EFCore_{name}.ib", + Database = $"{path}EFCore_{name}.ib", DataSource = "localhost", UserID = "sysdba", Password = "masterkey", diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.md b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.md new file mode 100644 index 0000000..5c88c8f --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.md @@ -0,0 +1,18 @@ +# Changes for 7.12.1 + +## InsertTests.cs +* Switched from using Identity columns to Sequence triggers + +# Changes for 7.10.2 + +## General - +* All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. + +## Common +* Namespaces changed from FirebirdSql.EntityFrameworkCore.Firebird.Tests to InterBaseSql.EntityFrameworkCore.InterBase.Tests +* Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. + +* All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. +* For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup + +* using FirebirdSql.Data.FirebirdClient now using InterBaseSql.Data.InterBaseClient diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.txt deleted file mode 100644 index 563b1ba..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Changelog.txt +++ /dev/null @@ -1,13 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - Namespaces changed from FirebirdSql.EntityFrameworkCore.Firebird.Tests to InterBaseSql.EntityFrameworkCore.InterBase.Tests - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - using FirebirdSql.Data.FirebirdClient now using InterBaseSql.Data.InterBaseClient \ No newline at end of file diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/Changelog.txt deleted file mode 100644 index 12c108a..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/Changelog.txt +++ /dev/null @@ -1,44 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - Namespaces changed from FirebirdSql.EntityFrameworkCore.Firebird.Tests.EndToEnd to InterBaseSql.EntityFrameworkCore.InterBase.Tests.EndToEnd - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - using FirebirdSql.Data.FirebirdClient now using InterBaseSql.Data.InterBaseClient - - DeleteTests.cs - Delete - Fixed up the Delete table creation to be IB SQL compliant - ConcurrencyDelete - Fixed up the Delete table creation to be IB SQL compliant - - InsertTests.cs - Insert - Fixed up the Delete table creation to be IB SQL compliant - ConcurrencyInsert - Fixed up the Delete table creation to be IB SQL compliant - IdentityInsert, DefaultValuesInsert and SequenceInsertNoID removed (Fb features) - SequenceInsertID - moved back to generator from sequence keyword - TwoComputedInsert - Relooked up the value after insert to retrieve server side changes - - UpdateTests.cs - Update changed 'update or insert' to just insert - Relook up server side changes - ComputedUpdateContext - changed the default computed to a real name (Fb feature) - ComputedUpdate, ConcurrencyUpdate, ConcurrencyUpdateNoGenerated and TwoComputedUpdate - Fixed up the non IB SQL - Relooked up the computed by columns - - - - - \ No newline at end of file diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/InsertTests.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/InsertTests.cs index e60efee..eaeb99b 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/InsertTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/EndToEnd/InsertTests.cs @@ -74,7 +74,7 @@ protected override void OnTestModelCreating(ModelBuilder modelBuilder) var insertEntityConf = modelBuilder.Entity(); insertEntityConf.Property(x => x.Id).HasColumnName("ID") - .UseIdentityColumn(); + .UseSequenceTrigger(); insertEntityConf.Property(x => x.Name).HasColumnName("NAME"); insertEntityConf.ToTable("TEST_INSERT_IDENTITY"); } @@ -222,7 +222,7 @@ protected override void OnTestModelCreating(ModelBuilder modelBuilder) var insertEntityConf = modelBuilder.Entity(); insertEntityConf.Property(x => x.Id).HasColumnName("ID") - .UseIdentityColumn(); + .UseSequenceTrigger(); insertEntityConf.Property(x => x.Name).HasColumnName("NAME"); insertEntityConf.Property(x => x.Computed1).HasColumnName("COMPUTED1") .ValueGeneratedOnAddOrUpdate(); diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Query/ElementaryTests.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Query/ElementaryTests.cs index 0300f35..c012416 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Query/ElementaryTests.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase.Tests/Query/ElementaryTests.cs @@ -213,7 +213,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) optionsBuilder.AddInterceptors(_lastCommandTextInterceptor); } - public string LastCommandText => _lastCommandTextInterceptor.LastCommandText; + public new string LastCommandText => _lastCommandTextInterceptor.LastCommandText; } class TMPAttachment diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.md b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.md new file mode 100644 index 0000000..c41c79f --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.md @@ -0,0 +1,33 @@ +# Changes for 7.12.1 +* For now IBValueGenerationStrategy.IdentityColumn remains, but is not a language feature supported by InterBase + +## IBModelBuilderExtensions.cs, IBPropertyBuilderExtensions.cs, IBPropertyExtensions.cs +* Removed UseIdentityColumns as InterBase does not support this + +# Changes for 7.10.2 + +## General - +* All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. + +## Common - +* Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Extensions to InterBaseSql.EntityFrameworkCore.InterBase.Extensions +* Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. + +* All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. +* For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup + +* using FirebirdSql.EntityFrameworkCore.Firebird.Infrastructure.Internal, FirebirdSql.EntityFrameworkCore.Firebird.Metadata now InterBaseSql.EntityFrameworkCore.InterBase.Infrastructure.Internal, +* InterBaseSql.EntityFrameworkCore.InterBase.Metadata + +## FbDatabaseFacadeExtensions.cs renamed to IBDatabaseFacadeExtensions.cs +* IsFirebird now IsInterBase + +## FbDbContextOptionsBuilderExtensions.cs renamed to IBDbContextOptionsBuilderExtensions.cs +* UseFirebird now UseInterBase + +## FbServiceCollectionExtensions.cs renamed to IBServiceCollectionExtensions.cs +* All using FirebirdSQLXxx renamed to using interBaseSQL.Xxxx +* fbServiceCollectionExtensions now IBServiceCollectionExtensions +* AddEntityFrameworkFirebird now AddEntityFrameworkInterBase + + diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.txt deleted file mode 100644 index 386d16a..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/Changelog.txt +++ /dev/null @@ -1,27 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - - Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Extensions to InterBaseSql.EntityFrameworkCore.InterBase.Extensions - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx to IBXxxxx with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - using FirebirdSql.EntityFrameworkCore.Firebird.Infrastructure.Internal, FirebirdSql.EntityFrameworkCore.Firebird.Metadata now InterBaseSql.EntityFrameworkCore.InterBase.Infrastructure.Internal, - InterBaseSql.EntityFrameworkCore.InterBase.Metadata - - FbDatabaseFacadeExtensions.cs renamed to IBDatabaseFacadeExtensions.cs - IsFirebird now IsInterBase - - FbDbContextOptionsBuilderExtensions.cs renamed to IBDbContextOptionsBuilderExtensions.cs - UseFirebird now UseInterBase - - FbServiceCollectionExtensions.cs renamed to IBServiceCollectionExtensions.cs - All using FirebirdSQLXxx renamed to using interBaseSQL.Xxxx - fbServiceCollectionExtensions now IBServiceCollectionExtensions - AddEntityFrameworkFirebird now AddEntityFrameworkInterBase - - \ No newline at end of file diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBModelBuilderExtensions.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBModelBuilderExtensions.cs index cefda27..a57ed47 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBModelBuilderExtensions.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBModelBuilderExtensions.cs @@ -26,12 +26,12 @@ namespace Microsoft.EntityFrameworkCore { public static class IBModelBuilderExtensions { - public static ModelBuilder UseIdentityColumns(this ModelBuilder modelBuilder) - { - var model = modelBuilder.Model; - model.SetValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); - return modelBuilder; - } + //public static ModelBuilder UseIdentityColumns(this ModelBuilder modelBuilder) + //{ + // var model = modelBuilder.Model; + // model.SetValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); + // return modelBuilder; + //} public static ModelBuilder UseSequenceTriggers(this ModelBuilder modelBuilder) { @@ -45,9 +45,9 @@ public static IConventionModelBuilder HasValueGenerationStrategy(this IConventio if (modelBuilder.CanSetAnnotation(IBAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { modelBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); - if (valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) - { - } + //if (valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) + //{ + //} if (valueGenerationStrategy != IBValueGenerationStrategy.SequenceTrigger) { } diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyBuilderExtensions.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyBuilderExtensions.cs index 2d0fe34..e5fff78 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyBuilderExtensions.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyBuilderExtensions.cs @@ -26,15 +26,15 @@ namespace Microsoft.EntityFrameworkCore { public static class IBPropertyBuilderExtensions { - public static PropertyBuilder UseIdentityColumn(this PropertyBuilder propertyBuilder) - { - var property = propertyBuilder.Metadata; - property.SetValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); - return propertyBuilder; - } + //public static PropertyBuilder UseIdentityColumn(this PropertyBuilder propertyBuilder) + //{ + // var property = propertyBuilder.Metadata; + // property.SetValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); + // return propertyBuilder; + //} - public static PropertyBuilder UseIdentityColumn(this PropertyBuilder propertyBuilder) - => (PropertyBuilder)UseIdentityColumn((PropertyBuilder)propertyBuilder); + //public static PropertyBuilder UseIdentityColumn(this PropertyBuilder propertyBuilder) + // => (PropertyBuilder)UseIdentityColumn((PropertyBuilder)propertyBuilder); public static PropertyBuilder UseSequenceTrigger(this PropertyBuilder propertyBuilder) { @@ -51,9 +51,9 @@ public static IConventionPropertyBuilder HasValueGenerationStrategy(this IConven if (propertyBuilder.CanSetAnnotation(IBAnnotationNames.ValueGenerationStrategy, valueGenerationStrategy, fromDataAnnotation)) { propertyBuilder.Metadata.SetValueGenerationStrategy(valueGenerationStrategy, fromDataAnnotation); - if (valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) - { - } + //if (valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) + //{ + //} if (valueGenerationStrategy != IBValueGenerationStrategy.SequenceTrigger) { } diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyExtensions.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyExtensions.cs index 647efe3..9ff8fc9 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyExtensions.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Extensions/IBPropertyExtensions.cs @@ -49,10 +49,10 @@ public static IBValueGenerationStrategy GetValueGenerationStrategy(this IPropert { return IBValueGenerationStrategy.SequenceTrigger; } - if (modelStrategy == IBValueGenerationStrategy.IdentityColumn && IsCompatibleIdentityColumn(property)) - { - return IBValueGenerationStrategy.IdentityColumn; - } + //if (modelStrategy == IBValueGenerationStrategy.IdentityColumn && IsCompatibleIdentityColumn(property)) + //{ + // return IBValueGenerationStrategy.IdentityColumn; + //} return IBValueGenerationStrategy.None; } @@ -76,10 +76,10 @@ static void CheckValueGenerationStrategy(IProperty property, IBValueGenerationSt { if (value != null) { - if (value == IBValueGenerationStrategy.IdentityColumn && !IsCompatibleIdentityColumn(property)) - { - throw new ArgumentException($"Incompatible data type for {nameof(IBValueGenerationStrategy.IdentityColumn)} for '{property.Name}'."); - } + //if (value == IBValueGenerationStrategy.IdentityColumn && !IsCompatibleIdentityColumn(property)) + //{ + // throw new ArgumentException($"Incompatible data type for {nameof(IBValueGenerationStrategy.IdentityColumn)} for '{property.Name}'."); + //} if (value == IBValueGenerationStrategy.SequenceTrigger && !IsCompatibleSequenceTrigger(property)) { throw new ArgumentException($"Incompatible data type for {nameof(IBValueGenerationStrategy.SequenceTrigger)} for '{property.Name}'."); diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/InterBaseSql.EntityFrameworkCore.InterBase.csproj b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/InterBaseSql.EntityFrameworkCore.InterBase.csproj index 45535da..8671f16 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/InterBaseSql.EntityFrameworkCore.InterBase.csproj +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/InterBaseSql.EntityFrameworkCore.InterBase.csproj @@ -10,7 +10,7 @@ NETProvider - Entity Framework Core Provider - (c) 2017-2021 + (c) 2017-2022 InterBaseSql.EntityFrameworkCore.InterBase diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.md b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.md new file mode 100644 index 0000000..38722c3 --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.md @@ -0,0 +1,28 @@ +# Changes for 7.12.1 + +## IBValueGenerationStrategyConvention.cs +* ProcessModelInitialized no longer initialized HasValueGenerationStrategy (this probably should be changed to the trigger value in next update) + +# Changes for 7.10.2 + +## General - +* All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. + +## Common - +* Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Conventions to InterBaseSql.EntityFrameworkCore.InterBase.Metadata.Conventions +* Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. + +* All files renamed from FbXxxxx.cs to IBXxxxx.cs with the internal class matching that same change. +* For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup + +* using FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Internal now InterBaseSql.EntityFrameworkCore.InterBase.Metadata.Internal where used + +## FbConventionSetBuilder.cs renamed to IBConventionSetBuilder.cs +* FbConventionSetBuilder now IBConventionSetBuilder +* Build's creation of the new ServiceCollection uses AddEntityFrameworkInterBase and UseInterBase + +## FbStoreGenerationConvention.cs renamed to IBStoreGenerationConvention.cs +* FbStoreGenerationConvention now IBStoreGenerationConvention + + + diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.txt deleted file mode 100644 index 86f1118..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/Changelog.txt +++ /dev/null @@ -1,23 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - - Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Conventions to InterBaseSql.EntityFrameworkCore.InterBase.Metadata.Conventions - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx.cs to IBXxxxx.cs with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - using FirebirdSql.EntityFrameworkCore.Firebird.Metadata.Internal now InterBaseSql.EntityFrameworkCore.InterBase.Metadata.Internal where used - - FbConventionSetBuilder.cs renamed to IBConventionSetBuilder.cs - FbConventionSetBuilder now IBConventionSetBuilder - Build's creation of the new ServiceCollection uses AddEntityFrameworkInterBase and UseInterBase - - FbStoreGenerationConvention.cs renamed to IBStoreGenerationConvention.cs - FbStoreGenerationConvention now IBStoreGenerationConvention - - - diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/IBValueGenerationStrategyConvention.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/IBValueGenerationStrategyConvention.cs index 061bacd..dc4af6f 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/IBValueGenerationStrategyConvention.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Metadata/Conventions/IBValueGenerationStrategyConvention.cs @@ -36,7 +36,7 @@ public IBValueGenerationStrategyConvention(ProviderConventionSetBuilderDependenc public virtual void ProcessModelInitialized(IConventionModelBuilder modelBuilder, IConventionContext context) { - modelBuilder.HasValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); +// modelBuilder.HasValueGenerationStrategy(IBValueGenerationStrategy.IdentityColumn); } public virtual void ProcessModelFinalized(IConventionModelBuilder modelBuilder, IConventionContext context) diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.md b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.md new file mode 100644 index 0000000..9c6069b --- /dev/null +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.md @@ -0,0 +1,30 @@ +# Changes 7.12.1 + +## IBMigrationsSqlGenerator.cs +* Removed/Commented all code around IBValueGenerationStrategy.IdentityColumn as InterBase does not support + +# Changes for 7.10.2 + +## General - +* All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. + +## Common - +* Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Migrations to InterBaseSql.EntityFrameworkCore.InterBase.Migrations +* Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. + +* All files renamed from FbXxxxx.cs to IBXxxxx.cs with the internal class matching that same change. +* For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup + +## FbMigrationSqlGeneratorBehavior.cs renamed to IBMigrationSqlGeneratorBehavior.cs +* FbMigrationSqlGeneratorBehavior now IBMigrationSqlGeneratorBehavior +* CreateSequenceTriggerForColumn no longer uses EXECUTE BLOCK which means lost the ability to check if the generator already exists +* CreateSequenceTriggerForColumn changes CREATE SEQUENCE to CREATE GENERATOR +* DropSequenceTriggerForColumn removed EXECUTE BLOCK which means loss of checking if trigger exists before dropping + +## FbMigrationsSqlGenerator.cs renamed to IBMigrationsSqlGenerator.cs +* using switched from the Firebird.Xxx to InterBase.Xxx +* FbMigrationsSqlGenerator now IBMigrationsSqlGenerator +* "Firebird" strings replaced with "InterBase" + + + diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.txt b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.txt deleted file mode 100644 index 66bf3c7..0000000 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/Changelog.txt +++ /dev/null @@ -1,25 +0,0 @@ -Changes for 7.10.2 - - General - - All class names and name spaces are changed to be IB vs Fb or Fes. This was done so that both the Fb driver and this driver it is based on will not have any naming conflicts if both used in the same application. - - Common - - Namespace changed from FirebirdSql.EntityFrameworkCore.Firebird.Migrations to InterBaseSql.EntityFrameworkCore.InterBase.Migrations - Use the IB named versions of classes and variable names where appropriate moved from fb to ib prefixes. - - All files renamed from FbXxxxx.cs to IBXxxxx.cs with the internal class matching that same change. - For example FbBackup.cs becomes IBBackup.cs and the class FbBackup is now IBBackup - - FbMigrationSqlGeneratorBehavior.cs renamed to IBMigrationSqlGeneratorBehavior.cs - FbMigrationSqlGeneratorBehavior now IBMigrationSqlGeneratorBehavior - CreateSequenceTriggerForColumn no longer uses EXECUTE BLOCK which means lost the ability to check if the generator already exists - CreateSequenceTriggerForColumn changes CREATE SEQUENCE to CREATE GENERATOR - DropSequenceTriggerForColumn removed EXECUTE BLOCK which means loss of checking if trigger exists before dropping - - FbMigrationsSqlGenerator.cs renamed to IBMigrationsSqlGenerator.cs - using switched from the Firebird.Xxx to InterBase.Xxx - FbMigrationsSqlGenerator now IBMigrationsSqlGenerator - "Firebird" strings replaced with "InterBase" - - - diff --git a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/IBMigrationsSqlGenerator.cs b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/IBMigrationsSqlGenerator.cs index e2349c9..46ba6f8 100644 --- a/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/IBMigrationsSqlGenerator.cs +++ b/NETProvider/Provider/src/InterBaseSql.EntityFrameworkCore.InterBase/Migrations/IBMigrationsSqlGenerator.cs @@ -89,10 +89,10 @@ protected override void Generate(AlterColumnOperation operation, IModel model, M { var valueGenerationStrategy = operation[IBAnnotationNames.ValueGenerationStrategy] as IBValueGenerationStrategy?; var oldValueGenerationStrategy = operation.OldColumn[IBAnnotationNames.ValueGenerationStrategy] as IBValueGenerationStrategy?; - if (oldValueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn && valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) - { - throw new InvalidOperationException("Cannot remove identity from column."); - } + //if (oldValueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn && valueGenerationStrategy != IBValueGenerationStrategy.IdentityColumn) + //{ + // throw new InvalidOperationException("Cannot remove identity from column."); + //} if (oldValueGenerationStrategy == IBValueGenerationStrategy.SequenceTrigger && valueGenerationStrategy != IBValueGenerationStrategy.SequenceTrigger) { _behavior.DropSequenceTriggerForColumn(operation.Name, operation.Table, operation.Schema, builder); @@ -120,10 +120,10 @@ protected override void Generate(AlterColumnOperation operation, IModel model, M var type = GetColumnType(operation.Schema, operation.Table, operation.Name, operation, model); builder.Append(type); } - if (valueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn) - { - builder.Append(" GENERATED BY DEFAULT AS IDENTITY"); - } + //if (valueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn) + //{ + // builder.Append(" GENERATED BY DEFAULT AS IDENTITY"); + //} builder.Append(operation.IsNullable ? string.Empty : " NOT NULL"); TerminateStatement(builder); @@ -307,10 +307,10 @@ protected override void ColumnDefinition(string schema, string table, string nam .Append(operation.ColumnType ?? GetColumnType(schema, table, name, operation, model)); var valueGenerationStrategy = operation[IBAnnotationNames.ValueGenerationStrategy] as IBValueGenerationStrategy?; - if (valueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn) - { - builder.Append(" GENERATED BY DEFAULT AS IDENTITY"); - } + //if (valueGenerationStrategy == IBValueGenerationStrategy.IdentityColumn) + //{ + // builder.Append(" GENERATED BY DEFAULT AS IDENTITY"); + //} DefaultValue(operation.DefaultValue, operation.DefaultValueSql, operation.ColumnType, builder); diff --git a/NETProvider/Provider/src/Perf/Perf.csproj b/NETProvider/Provider/src/Perf/Perf.csproj index 4ad931b..25e894e 100644 --- a/NETProvider/Provider/src/Perf/Perf.csproj +++ b/NETProvider/Provider/src/Perf/Perf.csproj @@ -1,7 +1,7 @@  Exe - netcoreapp3.1 + netcoreapp3.1;net60;net50 true @@ -19,6 +19,6 @@ - +