Ernesto Cullen | 29 Jul 15:27 2014
Picon

Problem reading resources on linux

I've created a small program to test firebird access with an embedded server on linux (with mono), but I am getting errors related to resources.

This is the program:
namespace ConsoleFBTest
{
    class MainClass
    {
        public static void Main (string[] args)
        {
            Console.WriteLine ("Creating database...");
            FbConnection.CreateDatabase("ServerType=1;client library=libfbembed;Dialect=3;Database=test.fdb;User=sysdba;password=masterkey");
        }
    }
}

easy enough, I just want to create a database. I've copied all firebird lib/* files into target dir, along with firebird.msg, security2.fdb, firebird.conf, intl/*. I tested that the embedded server works copying also isql and executing from command line.
When I run previous program, both from MonoDevelop and from command line, I get the output below. I think it may have to do with resources formatting or embedding in the firebird client dll? maybe eol characters? old mono version? running out of ideas here, please help!

Ernesto Cullen


Mono version:
-------------------------------------
mono --version
Mono JIT compiler version 2.10.8 (tarball Mon Apr  7 03:54:27 IST 2014)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          debugger softdebug
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)

NETProvider: NETProvider-4.2.0.0-MONO_LINUX
Firebird: FirebirdCS-2.5.3.26778-0.amd64


program output
-------------------------------------------------------------------
Creating database...

Unhandled Exception: System.ObjectDisposedException: The object was used after being disposed.
  at System.IO.UnmanagedMemoryStream.Seek (Int64 offset, SeekOrigin loc) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader.LoadResourceValues (.ResourceCacheItem[] store) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader.GetEnumerator () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.ReadResources () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetObjectInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetStringInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetString (System.String name) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Common.IscException.BuildSqlState () [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Common.IscException.BuildExceptionData () [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector (System.IntPtr[] statusVector, FirebirdSql.Data.Common.Charset charset) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector (System.IntPtr[] statusVector) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesDatabase.CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer dpb, System.String dataSource, Int32 port, System.String database) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer dpb) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) FirebirdSql.Data.FirebirdClient.FbConnectionInternal:CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer)
  at FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase (System.String connectionString, Int32 pageSize, Boolean forcedWrites, Boolean overwrite) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase (System.String connectionString) [0x00000] in <filename unknown>:0
  at ConsoleFBTest.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: The object was used after being disposed.
  at System.IO.UnmanagedMemoryStream.Seek (Int64 offset, SeekOrigin loc) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader.LoadResourceValues (.ResourceCacheItem[] store) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader+ResourceEnumerator.FillCache () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader+ResourceEnumerator..ctor (System.Resources.ResourceReader readerToEnumerate) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceReader.GetEnumerator () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.ReadResources () [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetObjectInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetObject (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetStringInternal (System.String name, Boolean ignoreCase) [0x00000] in <filename unknown>:0
  at System.Resources.ResourceSet.GetString (System.String name) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Common.IscException.BuildSqlState () [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Common.IscException.BuildExceptionData () [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector (System.IntPtr[] statusVector, FirebirdSql.Data.Common.Charset charset) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector (System.IntPtr[] statusVector) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.Client.Native.FesDatabase.CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer dpb, System.String dataSource, Int32 port, System.String database) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.FirebirdClient.FbConnectionInternal.CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer dpb) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) FirebirdSql.Data.FirebirdClient.FbConnectionInternal:CreateDatabase (FirebirdSql.Data.Common.DatabaseParameterBuffer)
  at FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase (System.String connectionString, Int32 pageSize, Boolean forcedWrites, Boolean overwrite) [0x00000] in <filename unknown>:0
  at FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase (System.String connectionString) [0x00000] in <filename unknown>:0
  at ConsoleFBTest.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0

--
"Either write something worth reading or do something worth writing" B. Franklin
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Ernesto Cullen | 28 Jul 16:26 2014
Picon

Compiling for mono

Hi all,
  I am trying to port an application using Firebird from Windows (.net 4.0) to Linux under Mono, and I am having problems with the firebird provider.
  I try to compile it using MonoDevelop 5.0 and could not build the project 'FirebirdSql.Data.FirebirdClient'. I get several errors regarding EntityFramework, which I resolved defining 'NET_35' in project options (there are  #if (!(NET_35 && !ENTITY_FRAMEWORK)) directives in several files, but the project had 'NET_40' defined), but I'm still getting errors like 'System.Data.Metadata' namespace not found.

- why is the expression using NET_35? does it compile in .net 4 under mono?
- Is the 'Entity' folder usable/needed under linux?


I removed the 'Entity' folder from the project. Now the build stops saying that 

FirebirdSql.Data.FirebirdClient/FirebirdClient/FbCommand.cs(22,22): Error CS1061: Type `FirebirdSql.Data.FirebirdClient.FbCommand' does not contain a definition for `expectedColumnTypes' and no extension method `expectedColumnTypes' of type `FirebirdSql.Data.FirebirdClient.FbCommand' could be found. Are you missing an assembly reference? (CS1061) (FirebirdSql.Data.FirebirdClient)

Looking at the top of the file I find the definition:

#if (!(NET_35 && !ENTITY_FRAMEWORK))
private Type[] expectedColumnTypes;
#endif

ENTITY_FRAMEWORK is not defined, NET_35 is defined, so the expression evaluates to 

if !(true && true) -> false
so the expectedColumnTypes definition is not compiled.

- is this array needed when Entity_framework is not defined, i.e. in Linux? if so, the expression is wrong. Or,
- if this array is not needed outside Entity framework, its usage should be enclosed in similar #if expression (lines 318, 368)

How do you compile the mono dll included in the release?

thanks,

Ernesto Cullen


--
"Either write something worth reading or do something worth writing" B. Franklin
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
diskuze | 28 Jul 10:36 2014
Picon

ADO.NET provider 4.5.0.0 for Firebird is ready

I'm pleased to announce new version of .NET provider. You can read more at
http://blog.cincura.net/233471-ado-net-provider-4-5-0-0-for-firebird-is-ready/ .

--

-- 
Mgr. Jiri Cincura
Independent IT Specialist

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
Jiri Cincura (JIRA | 28 Jul 09:39 2014

[FB-Tracker] Created: (DNET-562) Events getting "forgotten" for unknown reason

Events getting "forgotten" for unknown reason
---------------------------------------------

                 Key: DNET-562
                 URL: http://tracker.firebirdsql.org/browse/DNET-562
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 4.2.0.0
            Reporter: Jiri Cincura
            Assignee: Jiri Cincura

Reported by me privately, with more or less reliable steps to reproduce.

--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
André Ziegler (JIRA | 25 Jul 10:34 2014

[FB-Tracker] Created: (DNET-561) Add ETW logging support to the provider to get better error logging and have a way to trace the performance of the .Net provider

Add ETW logging support to the provider to get better error logging and have a way to trace the performance of
the .Net provider
--------------------------------------------------------------------------------------------------------------------------------

                 Key: DNET-561
                 URL: http://tracker.firebirdsql.org/browse/DNET-561
             Project: .NET Data provider
          Issue Type: New Feature
          Components: ADO.NET Provider
    Affects Versions: vNext
         Environment: Windows 8, VS2012 Update 4
            Reporter: André Ziegler
            Assignee: Jiri Cincura

With Microsoft.Diagnostics.Tracing.EventSource class
(https://www.nuget.org/packages/Microsoft.Diagnostics.Tracing.EventSource) there is a great
wrapper for Event Tracing for Windows (ETW -
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363668%28v=vs.85%29.aspx) which
can be easily used to log Events from the provider.

It would be nice if the EF provider would implement ETW events (at start and end of methods which shows how
long a method was executed) to allow perf tracing. It should also be used for logging errors/warnings.

--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
André Ziegler (JIRA | 25 Jul 10:22 2014

[FB-Tracker] Created: (DNET-560) Firebird .Net Provider Installer doesn't remove entries from the machine.config <DbProviderFactories> when removing/repair the provider

Firebird .Net Provider Installer doesn't remove entries from the machine.config
<DbProviderFactories> when removing/repair the provider
---------------------------------------------------------------------------------------------------------------------------------------

                 Key: DNET-560
                 URL: http://tracker.firebirdsql.org/browse/DNET-560
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 4.2.0.0
         Environment: Windows 8, VS2012 Update 4
            Reporter: André Ziegler
            Assignee: Jiri Cincura
            Priority: Critical

The Installer has some issues with the machine.config file. When you remove and older provider, the config
settings for Firebird under <DbProviderFactories> are still left in the config. 

Wen you now install a new FB provider version, a 2nd entry is added. This caused VS crashes for me when working
with DDEX provider when trying to do Reverse Engineering a DB to EDMX Model. Also, when you repair the
provider, a second entry is added. Also the structure of the XML config is corrupted, when the other entry
is added and this causes that other providers like SQL CE fail to load.

Removing all the bad entries fixes both VS issues (crash and SQL CE errors).

--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Geolffrey Mena (JIRA | 22 Jul 19:03 2014

[FB-Tracker] Created: (DNET-559) Null reference exception on fbcommand dispose in NET CF 3.5

Null reference exception on fbcommand dispose in NET CF 3.5
-----------------------------------------------------------

                 Key: DNET-559
                 URL: http://tracker.firebirdsql.org/browse/DNET-559
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.5.2
         Environment: Compact Framework 3.5
            Reporter: Geolffrey Mena
            Assignee: Jiri Cincura

My application is crashing and returning the following errors:

System.NullReferenceException was unhandled
  Message="NullReferenceException"
  StackTrace:
       at FirebirdSql.Data.FirebirdClient.FbCommand.RollbackImplicitTransaction()
       at FirebirdSql.Data.FirebirdClient.FbCommand.Release()
       at FirebirdSql.Data.FirebirdClient.FbCommand.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Finalize()

I realize this happen only when the application is trying to save (update/insert).

I have review this tracker system trying to find a solution and I found the bug was fixed in the version 2.7.7.
Which after some test does not work with Compact Framework 3.5. Is there any compiled version for Compact
Framework or can any of you can give some advise about what I need to do in order to make it work with NET CF 3.5.

Thanks in advanced.

--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
LtColRDSChauhan | 7 Jul 15:43 2014
Picon

Connecting to Firebird 3.0 Alpha 2

Hi,

1.  I attempted to migrate from Firebird 3.0 Alpha 1 to Alpha 2.  After a backup / restore I'm not able to connect to the database using .NET Provider.  I've the following updated in the Firebird Config file :

UserManager = Legacy_UserManager

AuthClient = Srp, Win_Sspi, Legacy_Auth


2.  FlameRobin connects fine.

3.  Please help.

Regards,
Lt Col RDS Chauhan
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Mark Rotteveel | 6 Jul 10:28 2014
Picon

Re: Scale Precision 4 Truncates to 2 in Database

On 6-7-2014 01:14, mark@... wrote:
> Your parameter is DECIMAL(18,2). If you want scale 2, specify that.

That should of course have read "If you want scale 4, specify that".

Mark

--

-- 
Mark Rotteveel

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
Muthu Annamalai | 6 Jul 00:46 2014
Picon

Scale Precision 4 Truncates to 2 in Database

Hi,
I am using Provider 4.2.0.0 and EF 6.0.0.0 in VS 2012. 
When I update a value with 4 digit precision as 1.9999, the value in
database is saved as 1.99. The last 2 digits got truncated. 
I really want 4 digit precision. Any help is appreciated.

In database table the field is set to a domain, which is

CREATE DOMAIN DECIMAL4 AS
NUMERIC(15,4)
DEFAULT 0
NOT NULL;

On submit changes from Visual Studio , the output from the provider is

FirebirdSql.Data.FirebirdClient Information: 0 : Command:
EXECUTE BLOCK (
p0 DECIMAL(18,2) =  <at> p0, p1 INT =  <at> p1
) RETURNS (
"DESCRIPTION" BLOB SUB_TYPE TEXT)
AS BEGIN
UPDATE "ITEMSTYLE"
SET "PRICE" = :p0
WHERE ("ID" = :p1)
RETURNING "DESCRIPTION" INTO :"DESCRIPTION";
SUSPEND;
END

Parameters:
Name: <at> p0	Type:Decimal	Used Value:1.9999
Name: <at> p1	Type:Integer	Used Value:19191

Thanks,
Annam

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
Andrew (JIRA | 3 Jul 08:18 2014

[FB-Tracker] Created: (DNET-558) FbCommand with CommandTest containing "EXECUTE BLOCK" will not excpet input FbParamaters

FbCommand with CommandTest containing "EXECUTE BLOCK" will not excpet input FbParamaters
----------------------------------------------------------------------------------------

                 Key: DNET-558
                 URL: http://tracker.firebirdsql.org/browse/DNET-558
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 4.2.0.0
         Environment: VS2013 .NET 4.0
            Reporter: Andrew
            Assignee: Jiri Cincura

When using a FbCommand object to execute a command which contains one or more FbParamters causes a FirebirdSql.Data.Common.IscException.
Below is details of how to reproduce as well as a fix.
Can someone please check that this problem is in fact a real problem (i.e. perhaps there is a way to already do
this). IF it is a bug, is the fixed code blow (towards end of this post) OK.

Exception details:
FirebirdSql.Data.Common.IscException occurred
  _HResult=-2146233088
  HResult=-2146233088
  IsTransient=false
  Message=Dynamic SQL Error
SQL error code = -104
Token unknown - line 2, column 35

Steps to reproduce:
1) Create a table to hold the example data:
CREATE TABLE ADDRESS (ADDRESSID INTEGER NOT NULL, STREET VARCHAR(50), LAST_MOD DATE);

2) Executing the following via a FbCommand object. Note that work as expected.
EXECUTE BLOCK AS
DECLARE VARIABLE ADDRESSID INT = 8;
DECLARE VARIABLE STREET VARCHAR(50) = 'Fred';
DECLARE VARIABLE LAST_MOD DATE = '2014-07-03 13:37:59';
BEGIN
    IF (EXISTS(SELECT ADDRESSID FROM ADDRESS WHERE ADDRESSID = :ADDRESSID)) THEN
        UPDATE ADDRESS SET STREET = :STREET, LAST_MOD = :LAST_MOD WHERE ADDRESSID = :ADDRESSID AND LAST_MOD < :LAST_MOD;
    ELSE
        INSERT INTO ADDRESS(ADDRESSID, STREET, LAST_MOD) VALUES(:ADDRESSID, :STREET, :LAST_MOD);
END;

3) Executing the following via a FbCommand object and use FbParamters to pass in variables.
EXECUTE BLOCK AS
DECLARE VARIABLE ADDRESSID INT =  <at> X;
DECLARE VARIABLE STREET VARCHAR(50) =  <at> Y;
DECLARE VARIABLE LAST_MOD DATE =  <at> Z;
BEGIN
    IF (EXISTS(SELECT ADDRESSID FROM ADDRESS WHERE ADDRESSID = :ADDRESSID)) THEN
        UPDATE ADDRESS SET STREET = :STREET, LAST_MOD = :LAST_MOD WHERE ADDRESSID = :ADDRESSID AND LAST_MOD < :LAST_MOD;
    ELSE
        INSERT INTO ADDRESS(ADDRESSID, STREET, LAST_MOD) VALUES(:ADDRESSID, :STREET, :LAST_MOD);
END;

C# Code below is a working example of the bug.

            string connectionString = "[Insert valid connection strign here]";
            connection = new FbConnection(connectionString);
            connection.Open();

            string sql = "EXECUTE BLOCK AS\r\n " +
                "DECLARE VARIABLE ADDRESSID INT =  <at> X;\r\n" +
                "DECLARE VARIABLE STREET VARCHAR(50) =  <at> Y;\r\n" +
                "DECLARE VARIABLE LAST_MOD DATE =  <at> Z;\r\n" +
                "BEGIN\r\n" +
                "    IF (EXISTS(SELECT ADDRESSID FROM ADDRESS WHERE ADDRESSID = :ADDRESSID)) THEN\r\n" +
                "        UPDATE ADDRESS SET STREET = :STREET, LAST_MOD = :LAST_MOD WHERE ADDRESSID = :ADDRESSID AND LAST_MOD <
:LAST_MOD;\r\n" +
                "    ELSE\r\n" +
                "        INSERT INTO ADDRESS(ADDRESSID, STREET, LAST_MOD) VALUES(:ADDRESSID, :STREET, :LAST_MOD);\r\n" +
                "END;";

            FbCommand fbCommand = new FbCommand(sql, connection);

            FbParameter fbParameter = new FbParameter(" <at> X", FbDbType.Integer);
            fbParameter.Value = 5;
            fbCommand.Parameters.Add(fbParameter);

            fbParameter = new FbParameter(" <at> Y", FbDbType.VarChar);
            fbParameter.Size = 50;
            fbParameter.Value = "Fred";
            fbCommand.Parameters.Add(fbParameter);

            fbParameter = new FbParameter(" <at> Z", FbDbType.Date);
            fbParameter.Value = DateTime.Now;
            fbCommand.Parameters.Add(fbParameter);

            fbCommand.ExecuteNonQuery();

4) The below is a fix. Can someone please check that it is OK?
Edit the following source file: $\NETProvider\source\FirebirdSql\Data\FirebirdClient\FbCommand.cs
See if block following comments "Work around for "EXECUTE BLOCK" with FbParameters."

		private void Prepare(bool returnsSet)
		{
			LogCommand();

			FbConnectionInternal innerConn = this.connection.InnerConnection;

			// Check if	we have	a valid	transaction
			if (this.transaction == null)
			{
				if (innerConn.IsEnlisted)
				{
					this.transaction = innerConn.ActiveTransaction;
				}
				else
				{
					this.implicitTransaction = true;
					this.transaction = new FbTransaction(this.connection, this.connection.ConnectionOptions.IsolationLevel);
					this.transaction.BeginTransaction();

					// Update Statement	transaction
					if (this.statement != null)
					{
						this.statement.Transaction = this.transaction.Transaction;
					}
				}
			}

			// Check if	we have	a valid	statement handle
			if (this.statement == null)
			{
				this.statement = innerConn.Database.CreateStatement(this.transaction.Transaction);
			}

			// Prepare the statement if	needed
			if (!this.statement.IsPrepared)
			{
				// Close the inner DataReader if needed
				this.CloseReader();

				// Reformat the SQL statement if needed
				string sql = this.commandText;

				if (this.commandType == CommandType.StoredProcedure)
				{
					sql = this.BuildStoredProcedureSql(sql, returnsSet);
				}

				try
				{
                    //Work around for "EXECUTE BLOCK" with FbParameters.
                    if (sql.ToUpper().StartsWith("EXECUTE BLOCK") && sql.ToUpper().Contains("DECLARE VARIABLE") &&
this.parameters.Count > 0)
                    {
                        sql = this.SubstituteParameters(sql);
                    }

                    // Try to prepare the command
					this.statement.Prepare(this.ParseNamedParameters(sql));
				}
				catch
				{
					// Release the statement and rethrow the exception
					this.statement.Release();
					this.statement = null;

					throw;
				}

				// Add this	command	to the active command list
				innerConn.AddPreparedCommand(this);
			}
			else
			{
				// Close statement for subsequently	executions
				this.Close();
			}
		}

New code...
        private string SubstituteParameters(string sql)
        {
            string sqlCommand = sql;
            for (int i = 0; i < this.parameters.Count; i++)
            {
                FbParameter fbParameter = this.parameters[i];
                if (fbParameter.Value == null)
                {
                    sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, "NULL");
                }
                else
                {
                    switch (fbParameter.FbDbType)
                    {
                        case FbDbType.BigInt:
                            long longValue = (long)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, longValue.ToString());
                            break;

                        case FbDbType.Boolean:
                            bool boolValue = (bool)fbParameter.Value;
                            string boolStringValue = "0";
                            if (boolValue)
                            {
                                boolStringValue = "1";
                            }
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, boolStringValue);
                            break;

                        case FbDbType.Char:
                        case FbDbType.Text:
                        case FbDbType.VarChar:
                            string strValue = (string)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, "'" + strValue.Replace("'", "''") + "'");
                            break;

                        case FbDbType.Date:
                        case FbDbType.Time:
                        case FbDbType.TimeStamp:
                            DateTime dateValue = (DateTime)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, "'" + dateValue.ToString("yyyy-MM-dd
HH:mm:ss") + "'");
                            break;

                        case FbDbType.Decimal:
                            decimal decValue = (decimal)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, decValue.ToString());
                            break;

                        case FbDbType.Double:
                            double dblValue = (double)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, dblValue.ToString());
                            break;

                        case FbDbType.Float:
                            float floatValue = (float)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, floatValue.ToString());
                            break;

                        case FbDbType.Guid:
                            Guid guid = (Guid)fbParameter.Value;
                            string guidString = "CHAR_TO_UUID('" + guid.ToString() + "')";
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, guidString.ToString());
                            break;

                        case FbDbType.Integer:
                            int intValue = (int)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, intValue.ToString());
                            break;

                        case FbDbType.Numeric:
                            double numValue = (double)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, numValue.ToString());
                            break;

                        case FbDbType.SmallInt:
                            short shtValue = (short)fbParameter.Value;
                            sqlCommand = sqlCommand.Replace(fbParameter.ParameterName, shtValue.ToString());
                            break;

                        default:
                            throw new NotImplementedException("Parameter of " + fbParameter.FbDbType.ToString("G") + " not
implemented in 'EXECUTE BLOCK' commands.");

                    }
                }

            }
            return sqlCommand;
        }

--

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft

Gmane