From: Pavol S. <st...@ra...> - 2003-02-20 21:32:13
|
hi, how it is with blobs??? i didnt find anything in docs... is it not = implemented or it is maped to another type? If remaped how... thanx p. |
From: Pavol S. <st...@ra...> - 2003-02-22 22:35:13
|
hi, can you please put here examples how to write and read blobs??? Reading is ok with reader, but how to write if i dont want to use = adapter??? Please wire example with smallest overheat... I need very fast = solution... I done it some way, but im not satisfied with it... thanx p. |
From:
<car...@te...> - 2003-02-22 23:43:41
|
Hello: > Reading is ok with reader, but how to write if i dont want to use adapter??? > Please wire example with smallest overheat... I need very fast > solution... I done it some way, but im not satisfied with it... Here is a sample for update a text blob field : using System; using System.IO; using System.Data; using System.Xml; using FirebirdSql.Data.Firebird; namespace Tests { public class ClobTest { public static void Main(string[] args) { string connectionString = "User=SYSDBA;Password=masterkey;" + @"Database=testdb.gdb;" + "DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;" + "Role=;Connection lifetime=0;Pooling=true"; FbConnection myConnection = new FbConnection(connectionString); myConnection.Open(); FbTransaction myTransaction = myConnection.BeginTransaction(); FbCommand myCommand = new FbCommand(); myCommand.CommandText = "UPDATE TEST_TABLE_01 SET CLOB_FIELD = @CLOB_FIELD WHERE INT_FIELD = @INT_FIELD"; myCommand.Connection = myConnection; myCommand.Transaction = myTransaction; myCommand.Parameters.Add("@INT_FIELD", FbType.Integer, "INT_FIELD"); myCommand.Parameters.Add("@CLOB_FIELD", FbType.Text, "CLOB_FIELD"); myCommand.Parameters[0].Value = 1; myCommand.Parameters[1].Value = GetFileContents(@"GDS.CS"); myCommand.ExecuteNonQuery(); myCommand.Dispose(); myTransaction.Commit(); myConnection.Close(); } public static string GetFileContents(string fileName) { StreamReader reader = new StreamReader(new FileStream(fileName, FileMode.Open)); string contents = reader.ReadToEnd(); reader.Close(); return contents; } } } Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Pavol S. <st...@st...> - 2003-02-23 00:44:11
|
You are right, it will throw exception, but foreach it's same (using GetEnumerator and MoveNext too...)... But you can get collection of keys and enumerate throw that collection... So when you remove connection keys collection is unchanged and there is no exception... p. ----- Original Message ----- From: "Carlos Guzmán Álvarez" <car...@te...> To: "Pavol Starek" <pa...@st...> Cc: <fir...@li...> Sent: Sunday, February 23, 2003 1:30 AM Subject: Re: [Firebird-net-provider] blobs > Hello: > > > i think you can remove it becouse unlocked is locked and in while you move > > to next, so you will not read null connection... To clean up unlocked you > > can put that line after while loop... > > Reason for this is: If you have 100 pooled connections first 50 is ok and > > last 50 is old, so you will go throw first 50 and then you will remove 51 > > and GetEnumerator() will reset counter to 0 so you will do it again from > > zero... so you will do 50x50 (litle more) while cycles... > > In my case you will do only 100 cycles... > > > As i remember MoveNext() will throw an exception if i don't make it ( i > will see it again i will try with a foreach too ). > > > > > If im wrong write it... Im just learning your code... > > > No problem it's good thing :) > > > > next think is: > > > > private void RunCleanUp() > > { > > TimeSpan interval = new TimeSpan(0, 0, 10); > > > > while (true) > > { > > -> lock (this) > > { > > CleanUp(null); > > } > > > > Thread.Sleep(interval); > > } > > } > > > > you dont need to lock whole class instance, becouse in CleanUp you are > > working only with unlocked instance variable and its locked there... If you > > have lot of connections (and there is above situation) pool is locked too > > long... > > > You are rigth here, thanks very much :) > > > > > Best regards > Carlos Guzmán Álvarez > Vigo-Spain > > |
From:
<car...@te...> - 2003-02-23 01:05:23
|
Hello: > You are right, it will throw exception, but foreach it's same (using > GetEnumerator and MoveNext too...)... Yes i have it tested yet :), thanks. > But you can get collection of keys and enumerate throw that collection... So > when you remove connection keys collection is unchanged and there is no > exception... Ok i will try it, thanks. Now i have made some changes to connectionpool implementation for use ArrayList instead of Hashtable and other little changes ( like change "Object o" declarations to "FbIscConnection connection" ), i will commit them after made some tests :D Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2003-02-23 14:26:23
|
Hello: > Now i have made some changes to connectionpool implementation for use > ArrayList instead of Hashtable and other little changes ( like change > "Object o" declarations to "FbIscConnection connection" ), i will commit > them after made some tests :D I have commited the changes yet. Best regards Carlos Guzmán Álvarez Vigo-Spain |
From:
<car...@te...> - 2003-02-20 22:11:53
|
Hello: how it is with blobs??? i didnt find anything in docs... is it not implemented or it is maped to another type? If remaped how... The support for blobs ( both text and bynary ) is implemented see FbDataReader.cs, Blob.cs, FbBlob.cs and FbClob.cs files. Best regards Carlos Guzmán Álvarez Vigo-Spain |