Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it possible to write large strings to Firebird blob?
    text
    copied!<p>The documentation for Firebird implies that you can write large (> 60K) strings to a blob value in a table. So if you have this:</p> <pre><code>CREATE TABLE MyBlobTable ( theId int PRIMARY KEY NOT NULL, theBlob BLOB SUB_TYPE 1 ) </code></pre> <p>Then this should work:</p> <pre><code>insert into MyBlobTable (theId, theBlob) values (1, '[60K characters in a string]') </code></pre> <p>(example inspired by <a href="http://web.firebirdsql.org/dotnetfirebird/blob-sub_type-1-reading-example-csharp.html" rel="nofollow">http://web.firebirdsql.org/dotnetfirebird/blob-sub_type-1-reading-example-csharp.html</a>)</p> <p>But I've found that neither C# drivers nor FlameRobin can write this value. You get 'Unexpected end of command' (pointing to a spot about 32K into the string, which is a little suspicious)</p> <p>I figure there is a special way to quote or escape the data values, or maybe a C# equivalent of this Java code (http://www.firebirdfaq.org/faq372/) where a binary file is read directly into the statement. I'm not doing anything fancy with the text data so I'm open to storing it as a binary blob if needed.</p> <p>Thanks!</p> <p>Update: "parameterized queries" is the phrase that I was looking for. What I'm doing: </p> <pre><code>FbParameter param = new FbParameter("@blobVal", FbDbType.Text); param.Value = myLargeString; String query = "insert into MyBlobTable (theId, theBlob) values (1, @blobVal)"; using (FbConnection conn = [something from my pool]) { using (FbCommand cmd = new FbCommand(query, conn)) { cmd.Parameters.Add(param); cmd.ExecuteNonQuery(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload