<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Longblob(JPG) aus MySQL in TImage ausgeben]]></title><description><![CDATA[<p>Hi,</p>
<p>Mein Problem bezieht sich auf Borland C++ Builder 6 und MySQL 5.0.16.<br />
Ich habe eine Datenbank unter MySQL laufen, in der sich Bilder befinden, die ich ausgeben will. Das Feld &quot;image&quot;, in der sich die Bilder befinden, besitzt das Format &quot;longblob&quot; und die Bilder sind im Format JPG.</p>
<p>Eine Ausgabe über DBImage ist nicht möglich, da die Bilder als JPG gespeichert sind und nicht als BMP. Aus diesem Grunde habe ich versucht, die Bilder in einem TImage auszugeben.</p>
<p>Mit Hilfe eines anderen Forums, wurde dieser Quelltext fertig.<br />
Jedoch hängt man an der unten beschriebenen Stelle fest. Aus diesem Grunde hoffe ich, dass ihr weiterhelfen könnt.</p>
<pre><code>TStream *pStream;
   TJPEGImage *pJPG;
   Form2-&gt;Query1-&gt;Fields-&gt;CheckFieldNames(&quot;image&quot;);
   Form2-&gt;Query1-&gt;Fields-&gt;FieldByName(&quot;image&quot;);
   pStream = Form2-&gt;Query1-&gt;CreateBlobStream(Form2-&gt;Query1-&gt;Fields-&gt;FieldByName(&quot;image&quot;),bmRead);

   AnsiString T; -&gt; Kontrolle ob Daten sich im Stream befinden
   T = pStream-&gt;Size;
   Label5-&gt;Caption = T; -&gt; Ausgabe der Größe (passt 100%tig)

   [b]pJPG-&gt;LoadFromStream(pStream);[/b] -&gt; Abbruch: EAccess Violation
   Image1-&gt;Picture-&gt;Assign(pJPG);
</code></pre>
<p>Alle anderen Felder der DB lese ich über Data Control Units aus, die auch funktionieren.</p>
<p>MfG</p>
<p>Ps.: Für jeden Denkanstoss bin ich dankbar. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/162113/longblob-jpg-aus-mysql-in-timage-ausgeben</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 01:00:24 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/162113.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Oct 2006 21:31:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Sat, 14 Oct 2006 21:31:25 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Mein Problem bezieht sich auf Borland C++ Builder 6 und MySQL 5.0.16.<br />
Ich habe eine Datenbank unter MySQL laufen, in der sich Bilder befinden, die ich ausgeben will. Das Feld &quot;image&quot;, in der sich die Bilder befinden, besitzt das Format &quot;longblob&quot; und die Bilder sind im Format JPG.</p>
<p>Eine Ausgabe über DBImage ist nicht möglich, da die Bilder als JPG gespeichert sind und nicht als BMP. Aus diesem Grunde habe ich versucht, die Bilder in einem TImage auszugeben.</p>
<p>Mit Hilfe eines anderen Forums, wurde dieser Quelltext fertig.<br />
Jedoch hängt man an der unten beschriebenen Stelle fest. Aus diesem Grunde hoffe ich, dass ihr weiterhelfen könnt.</p>
<pre><code>TStream *pStream;
   TJPEGImage *pJPG;
   Form2-&gt;Query1-&gt;Fields-&gt;CheckFieldNames(&quot;image&quot;);
   Form2-&gt;Query1-&gt;Fields-&gt;FieldByName(&quot;image&quot;);
   pStream = Form2-&gt;Query1-&gt;CreateBlobStream(Form2-&gt;Query1-&gt;Fields-&gt;FieldByName(&quot;image&quot;),bmRead);

   AnsiString T; -&gt; Kontrolle ob Daten sich im Stream befinden
   T = pStream-&gt;Size;
   Label5-&gt;Caption = T; -&gt; Ausgabe der Größe (passt 100%tig)

   [b]pJPG-&gt;LoadFromStream(pStream);[/b] -&gt; Abbruch: EAccess Violation
   Image1-&gt;Picture-&gt;Assign(pJPG);
</code></pre>
<p>Alle anderen Felder der DB lese ich über Data Control Units aus, die auch funktionieren.</p>
<p>MfG</p>
<p>Ps.: Für jeden Denkanstoss bin ich dankbar. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1154875</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1154875</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Sat, 14 Oct 2006 21:31:25 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Sat, 14 Oct 2006 21:34:03 GMT]]></title><description><![CDATA[<p>Sagt dir das Schlüsselwort <em>new</em> etwas?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1154876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1154876</guid><dc:creator><![CDATA[Jansen]]></dc:creator><pubDate>Sat, 14 Oct 2006 21:34:03 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 17 Oct 2006 19:15:24 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/52">@Jansen</a></p>
<p>Ja, <em>new</em> dient (laut dem Buch von &quot;Richard Kaiser&quot;) zur Speicherreservierung und dessen Ausgabe wärend der Laufzeit.<br />
Jedoch weiß ich nicht genau, worauf du hinaus willst.</p>
<p>Kann es sein das du dies meinst???</p>
<pre><code>pStream = new TStream(Form2-&gt;Query1-&gt;CreateBlobStream(Form2-&gt;Query1-&gt;Fields-&gt;FieldByName(&quot;image&quot;),bmRead));
</code></pre>
<p>Glaube nicht, oder???<br />
Dort bekomme ich die Fehlermeldungen:<br />
E2352 Cannot create instance of abstract class 'TStream'<br />
E2353 Class 'TStream' is abstract because of '_fastcall TStream::Read(void *,int) = 0'</p>
<p>Soweit ich das deuten kann, verlangt der TSream einen Wert. Wenn ja, wo soll ich diesen eintragen. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Aber Warum? TSream bekommt doch einen Wert übergeben, diesen habe ich doch schon ausgegeben (zumindest seine Größe im &quot;Label5&quot;).</p>
<p>Du musst &quot;etwas&quot; Nachsicht mit mir haben, innerhalb der Ausbildung habe ich nur programmiert und diese liegt leider schon ein paar Jahre zurück.</p>
<p>MfG</p>
<p>---------------------------------------------------------------------</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/52">@Jansen</a></p>
<p>Danke für den Hinweis, war genau der Richtige. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<pre><code>TStream *pStream;
   TJPEGImage *pJPG = new TJPEGImage();;
   pStream = Form2-&gt;Query1-&gt;CreateBlobStream(Form2-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead);
   pJPG-&gt;LoadFromStream(pStream);
   Image1-&gt;Picture-&gt;Assign(pJPG);
   delete pStream;
   delete pJPG;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1155122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1155122</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Tue, 17 Oct 2006 19:15:24 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Sun, 15 Oct 2006 16:12:26 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>nein die Fehlermeldugn heißt das TStream eine abstrakte Basiskalsse ist ohne vollständige Implementierung. Du must stattdessen eine Instanz von Klassen erstellen, die von TStream abgeleitet sind. Zum Beispiel TFileStream oder (das wäre wohl das richtige für dich) TMemoryStream. Und dann haben deren Konstruktoren auch keine Parameter. Das kannst du aber alles in der BCB-Hilfe nachlesen. Für die Grundlagen in objektorientierter Programmierung solltest du unbedingt ein entsprechendes <a href="http://tutorial.schornboeck.net/oop.htm" rel="nofollow">Tutorial</a> durcharbeiten.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1155207</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1155207</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sun, 15 Oct 2006 16:12:26 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Sun, 15 Oct 2006 19:53:29 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a></p>
<p>Danke für den Link, werde mich mal daran zu schaffen machen.</p>
<p>Der Code aus der unteren Zeile funktioniert, warum dann eine abstrakte Klasse???</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1155281</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1155281</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Sun, 15 Oct 2006 19:53:29 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Mon, 16 Oct 2006 14:19:52 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/13858">@1753</a>: Dein Code ist so jetzt korrekt.<br />
Die Methode CreateBlobStream erzeugt einen konkreten &quot;TBlobStream&quot;, so daß du in deinem Aufruf einfach die abstrakte Klasse &quot;TStream&quot; benutzen kannst.<br />
Nur wenn du genauere Infos über den BlobStream benötigst, müßtest du die Klasse &quot;TBlobStream&quot; benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1155770</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1155770</guid><dc:creator><![CDATA[Th]]></dc:creator><pubDate>Mon, 16 Oct 2006 14:19:52 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 17 Oct 2006 19:14:22 GMT]]></title><description><![CDATA[<p>Mit TBlobStream hat das ganze nicht funktioniert.<br />
Ich bin zwar nicht sicher, aber es kam der &quot;TBlobStream funktioniert nicht mit TStream&quot; (so in etwa).</p>
<p>Deswegen auch TStream.</p>
<p>Eine Frage, ist TBlobStream nicht von TStream abgeleitet???</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1156586</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1156586</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Tue, 17 Oct 2006 19:14:22 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Wed, 18 Oct 2006 08:20:46 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Was funktioniert nicht? Versuch bitte die genaue Fehlermeldung zu posten. Sie läßt sich auch aus dem Anzeigefenster heraus kopieren.<br />
TBlobStream ist von TStream abgeleitet, was dir ein Blick in die Hilfe zu TBlobStream (Hirarchie) auch verraten hätte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1156799</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1156799</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 18 Oct 2006 08:20:46 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Thu, 19 Oct 2006 13:19:01 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1387">@Braunstein</a></p>
<p>Das TBlobStream von TStream abgeleitet wird, habe ich doch schon mitbekommen.</p>
<p>Zitat: &quot;Eine Frage, ist TBlobStream nicht von TStream abgeleitet???&quot;<br />
Ich war mir aber nicht ganz sicher und deshalb habe ich nachgefragt.<br />
Ich hätte das <strong>nicht</strong> auch weglassen können. OK?</p>
<p>Der Code aus meinem zweiten Post hat auch funktioniert, doch als ich versucht habe</p>
<pre><code>TBlobStream *pStream;
</code></pre>
<p>zu schreiben/nutzen, da habe ich die Fehlermeldung bekommen, dass TBlobStream nicht in Verbindung mit TSream funktionieren würde. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157667</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Thu, 19 Oct 2006 13:19:01 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Thu, 19 Oct 2006 15:31:50 GMT]]></title><description><![CDATA[<p>Dann habe ich das mit dem <strong>nicht</strong> falsch verstanden.<br />
Bei welcher Zeile kommt denn diese Fehlermeldung? Bei der Dekalrattion kann es ja nicht sein. Es fehlt also immernoch der relevante Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1157758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1157758</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 19 Oct 2006 15:31:50 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Fri, 20 Oct 2006 09:23:30 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1387">@Braunstein</a></p>
<p>Wenn ich versuche TBlobStream anstatt TSream zu nutzen, bekomme ich die Fehlermeldungen, die hinter dem Code stehen.</p>
<pre><code>TBlobStream *pBlob = new TBlobStream(); [b]//Could not find a match for 'TBlobStream::TBlobStream()'[/b]
TJPEGImage *pJPG = new TJPEGImage();
pBlob = Form1-&gt;Query1-&gt;CreateBlobStream(Form1-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead); [b]//Cannot convert 'TStream *' to 'TBlobStream *'[/b]
pJPG-&gt;LoadFromStream(pStream);
Image1-&gt;Picture-&gt;Assign(pJPG);
delete pBlob;
delete pJPG;
</code></pre>
<p>Wenn ich versuche bei TBlobStream das <strong>new</strong> wegzulassen (Siehe Code),</p>
<pre><code>TBlobStream *pBlob;
TJPEGImage *pJPG = new TJPEGImage();
pBlob = Form1-&gt;Query1-&gt;CreateBlobStream(Form1-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead);
pJPG-&gt;LoadFromStream(pStream);
Image1-&gt;Picture-&gt;Assign(pJPG);
delete pBlob;
delete pJPG;
</code></pre>
<p>bekomme ich den Fehler: **Cannot convert 'TStream <em>' to 'TBlobStream <em>'</em></em></p>
<p>ABER, mit TStream funktioniert das ganze und dann sieht der Code auch so aus:</p>
<pre><code>void __fastcall TForm3::Button2Click(TObject *Sender)
{
TStream *pStream;
TJPEGImage *pJPG = new TJPEGImage();
pStream = Form1-&gt;Query1-&gt;CreateBlobStream(Form1-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead);
pJPG-&gt;LoadFromStream(pStream);
Image1-&gt;Picture-&gt;Assign(pJPG);
delete pStream;
delete pJPG;
}
</code></pre>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1158165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158165</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Fri, 20 Oct 2006 09:23:30 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Fri, 20 Oct 2006 09:38:59 GMT]]></title><description><![CDATA[<p>Na dann mach es auch so wie es funktioniert. Das mit dem new ist sowieso Unsinn. Da würdest du Speicher für ein TBlobStream-Objekt bereitstellen. Dann überschreibst du deinen Zeiger bei Aufruf von CreateBlobStream gleich wieder -&gt; Speicherleck. Außerdem verlangt der Konstruktor von TBlobStream 2 Parameter (1. Fehlermeldung).<br />
Bei der zweiten Variante müsstest du einfach nach TBlobStream casten (dynamic_cast), da CreateBlobStream ja ein TStream-Objekt zurückliefert. Probier das hier mal</p>
<pre><code class="language-cpp">TBlobStream *pBlob;
TJPEGImage *pJPG = new TJPEGImage();
pBlob = dynamic_cast&lt;TBlobStream*&gt;(Form1-&gt;Query1-&gt;CreateBlobStream(Form1-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead));
if( pBlob ) // Kontrolle ob es wirklich ein TBlobStream ist
{
  pJPG-&gt;LoadFromStream(pStream);
  Image1-&gt;Picture-&gt;Assign(pJPG);
  delete pBlob;
}
delete pJPG;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1158178</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1158178</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 20 Oct 2006 09:38:59 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Mon, 23 Oct 2006 12:25:36 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1387">@Braunstein</a><br />
Danke, funktioniert auch wunderbar.</p>
<p>Das mit &quot;dynamic_cast&quot; habe ich noch nicht gekannt, aber das Tutorial von &quot;akari&quot; hat das gut erklärt.</p>
<p>@ALL<br />
Danke für Eure Hilfe, echt SUPER hier!!! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1159503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1159503</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Mon, 23 Oct 2006 12:25:36 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 24 Oct 2006 16:11:45 GMT]]></title><description><![CDATA[<p>Wenn jemand noch Lust und Laune hat, ich hätte da noch ein &quot;kleines&quot; Problem.<br />
Es bezieht sich auch auf ein Image und meine Datenbank.</p>
<p>Ich versuche aus einem Image heraus, ein Bild (JPG) in der Datenbank zu speichern.<br />
Ohne Erfolg!!!</p>
<p>Als erstes habe ich über TOpenPictureDialog ein Bild geladen. Funktioniert!!!</p>
<pre><code>void __fastcall TForm4::Button2Click(TObject *Sender)
{
if (OpenPictureDialog1-&gt;Execute())
  { 
  Image1-&gt;Picture-&gt;LoadFromFile(OpenPictureDialog1-&gt;FileName);
  }
}
</code></pre>
<p>Danach habe ich versucht, das Image auszulesen und in einen TJPEGImage zu speichern. Funktioniert auch!!!<br />
Doch aus dem TJPEGImage die Daten in ein TBlobStream zu bekommen schlägt fehl.</p>
<p>Mein Versuch:</p>
<pre><code>TBlobStream *pBlob;
TJPEGImage *pJPG = new TJPEGImage();
pBlob = dynamic_cast&lt;TBlobStream*&gt;(Form1-&gt;Query1-&gt;CreateBlobStream(Form1-&gt;Query1-&gt;FieldByName(&quot;image&quot;),bmRead));
Image1-&gt;Picture-&gt;Graphic-&gt;SaveToStream(pBlob);
</code></pre>
<p>Leider komme ich dann hier auch nicht weiter. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Ich kann den pBlob wieder in einem Image ausgeben, aber nicht an die Datenbank.</p>
<p>INSERT mit den &quot;Normalen&quot; Datensätzen aus den Edit- feldern funktioniert.<br />
(Textbasiert)</p>
<pre><code>Form1-&gt;Query1-&gt;Close();
Form1-&gt;Query1-&gt;SQL-&gt;Clear();
Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, [b]image[/b]) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;','&quot;+[b]pBlob[/b]+&quot;')&quot;);
Form1-&gt;Query1-&gt;ExecSQL();
</code></pre>
<p>Fehlermeldung hier: pBlob ist kein AnsiString. Der Rest funzt!</p>
<p>MfG</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1387">@Braunstein</a><br />
Vielleicht hast du wieder einen spitzen Vorschlag. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160479</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160479</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Tue, 24 Oct 2006 16:11:45 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 24 Oct 2006 16:17:55 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>Doch aus dem TJPEGImage die Daten in ein TBlobStream zu bekommen schlägt fehl.</p>
</blockquote>
<p>Das heißt? Fehlerbeschreibung?</p>
<blockquote>
<p>Fehlermeldung hier: pBlob ist kein AnsiString. Der Rest funzt!</p>
</blockquote>
<p>Die Fehlermeldung ist doch aussagekräftig : SQL-Anweisungen sind immer Text. Du kannst nicht einfach einen Byte-Strteam hinzuaddieren. Sondern der muß Byte für Byte in Textformat konvertiert werden, wo die nicht darstellbaren Zeichen durch Hex- oder Oktalwerte maskiert werden. Als Beispiel <a href="http://www.postgresql.org/docs/8.1/static/datatype-binary.html" rel="nofollow">hier</a> die Umsetzungstabelle für PostgreSQL. Ob das so standardisiert ist weiß ich nicht, vermute aber schon.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160485</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160485</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 24 Oct 2006 16:17:55 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 24 Oct 2006 16:24:44 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p><a href="http://dev.mysql.com/doc/refman/5.1/de/binary-varbinary.html" rel="nofollow">Hier</a> ist die entsprechende Beschreibung für MySQL</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160491</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160491</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Tue, 24 Oct 2006 16:24:44 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Tue, 24 Oct 2006 16:47:21 GMT]]></title><description><![CDATA[<p>Den Blob-Stream sollte man doch besser über einen Parameter einfügen.<br />
Evtl. so</p>
<pre><code class="language-cpp">Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, image) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;',:imageblob)&quot;);
Form1-&gt;Query1-&gt;Params-&gt;ByName(&quot;imageblob&quot;)-&gt;LoadFromStream(pBlob);
Form1-&gt;Query1-&gt;ExecSQL();
</code></pre>
<p>Ist jetzt nicht getestet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160520</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160520</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Tue, 24 Oct 2006 16:47:21 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Wed, 25 Oct 2006 09:47:27 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1387">@Braunstein</a></p>
<p>Danke für Deine Hilfe.<br />
Ich hab das Ganze mal eingegeben, jedoch <strong>ByName</strong> ist kein Bestandteil von Parms. (laut CBuilder)</p>
<pre><code>Form1-&gt;Query1-&gt;Params-&gt;ByName(&quot;imageblob&quot;)-&gt;LoadFromStream(pBlob);
</code></pre>
<p>Dann hab ich mal nachgesehen was es denn unter Parms mit &quot;ByName&quot; so gibt.</p>
<pre><code>Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, image) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;',:imageblob)&quot;);
Form1-&gt;Query1-&gt;Params-&gt;[b]ParamByName[/b](&quot;imageblob&quot;)-&gt;LoadFromStream(pBlob);
Form1-&gt;Query1-&gt;ExecSQL();
</code></pre>
<p>Soweit ganz gut, jedoch kommt dann die Meldung <strong>LoadFromStream hat zu wenig Argumente</strong>.</p>
<p>Ok, dann hab ich mir gedacht, da es sich um den Feldtyp <strong>LongBlob</strong> in der Datenbank handelt, übergebe ich diesen auch mit <strong>ftBlob</strong></p>
<pre><code>Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, image) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;',:imageblob)&quot;);
Form1-&gt;Query1-&gt;Params-&gt;ParamByName(&quot;imageblob&quot;)-&gt;LoadFromStream(pBlob,[b]ftBlob[/b]);
Form1-&gt;Query1-&gt;ExecSQL();
</code></pre>
<p>Falsch gedacht, jetzt bekomme ich die Fehlermeldung EAccessViolation in Adresse 4002EAEF im Modul &quot;rtl60.bpl&quot;. Lesen von Adresse 5D010AAB gestoppt.<br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a></p>
<p>Ich hab mir das von MySQL durchgelesen, die sagen ja zum Schluß man solle lieber einen Blob-Typen verwenden, welchen ich ja benutze.</p>
<p>Meinst Du ich solle die Datenbank überarbeiten, oder nur die SQL-Anweisung???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160872</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160872</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Wed, 25 Oct 2006 09:47:27 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Wed, 25 Oct 2006 10:02:52 GMT]]></title><description><![CDATA[<p>Hallo</p>
<blockquote>
<p>Ich hab mir das von MySQL durchgelesen, die sagen ja zum Schluß man solle lieber einen Blob-Typen verwenden, welchen ich ja benutze.</p>
<p>Meinst Du ich solle die Datenbank überarbeiten, oder nur die SQL-Anweisung???</p>
</blockquote>
<p>Nein du must hier zwischen dem MySQL-Spaltentyp Blob und der Builder-Klasse TBlobStream unterscheiden. Die Aussage aus der MySQL-Doku bezieht sich auf ersteres, was bei dir aber schon erledigt ist (wenn du den Spaltentyp Blob schon verwendest)</p>
<p>Sondern bei dir geht es um die korrekte Integration des BlobStreams in eine bereits korrekte SQL-Anweisung. Offenbar brauchst du die Umwandlung nicht selber machen. Worum du den Fehler bekommst kann ich aber nicht nachvollziehen.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160880</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160880</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 25 Oct 2006 10:02:52 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Wed, 25 Oct 2006 14:39:04 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/7971">@akari</a></p>
<p>Anscheinend muß der BlobStream doch gewandelt werden, denn wenn ich versuche pBlob<br />
in der SQL-Anweisung zu integrieren, bekomme ich die Meldung:<br />
*<em>'operator+' not implemented in type 'AnsiString' for arguments of type 'TBlobStream <em>'</em></em></p>
<p>SQL Anweisung:</p>
<pre><code>Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, image) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;','&quot;[b]+pBlob+[/b]&quot;')&quot;);
</code></pre>
<p>Die gleiche Fehlermeldung kommt auch, wenn ich versuche <strong>pJPG</strong> anstatt <strong>pBlob</strong> zu verwenden. Auch <strong>Image1</strong> direkt anzugeben schlägt fehl, gleiche Meldung.</p>
<p>Herkunft pJPG</p>
<pre><code>TJPEGImage *pJPG = new TJPEGImage();
pJPG-&gt;Assign(Image1-&gt;Picture); // Übergabe des Images an pJPG
</code></pre>
<p>Ist es denn nicht möglich, das Image in Binärdaten zu wandeln.<br />
Denn alle Informationen innerhalb des LongBlob-Feldes werden ja auch Binär gespeichert.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1160951</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1160951</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Wed, 25 Oct 2006 14:39:04 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Wed, 25 Oct 2006 15:10:14 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Das einfache Addieren ist natürlich komplett flasch, und das habe ich auch schon vor 2 Posts gesagt.<br />
Mit eingebauter Konvertierung meine ich Braunsteins Methode. Und dort kann ich den Fehler den du meldest (Speicherzugriffsverletzung) nicht erklären.</p>
<p>Du must gar nichts in Binärdaten umwandeln, ganz im Gegenteil. Die Daten im (Blob-) Stream (auf keinen Fall das Image selber nehmen) sind bereits binär. Wnn dann müßtest du die Binärdaten ins textorientierte SQL-Format umwandelön, indem du byte für Byte des Streams durchgehst und wie in den Links beschrieben die Nichtdruckbaren Zeichen in Hexadezimal-Zahlen umwandeln.</p>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161087</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Wed, 25 Oct 2006 15:10:14 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Thu, 26 Oct 2006 11:04:15 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>Kann es sein, dass der Parameter nicht gefunden wird? Kontrollier das mal</p>
<pre><code class="language-cpp">TParam* param = Form1-&gt;Query1-&gt;Params-&gt;ParamByName(&quot;imageblob&quot;)-&gt;LoadFromStream(pBlob,ftBlob);
if( param == 0 )
{
// Fehlermeldung
}
</code></pre>
<p>Du kannst statt ParamByName ja auch folgendes verwenden</p>
<pre><code class="language-cpp">Form1-&gt;Query1-&gt;Params-&gt;Items[0]-&gt;LoadFromStream(pBlob, ftBlob);
</code></pre>
<p>Bei mir war das ein TIBSQL und kein TQuery. Deswegen die anderen Bezeichner und Parameter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161808</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161808</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 26 Oct 2006 11:04:15 GMT</pubDate></item><item><title><![CDATA[Reply to Longblob(JPG) aus MySQL in TImage ausgeben on Thu, 26 Oct 2006 12:09:12 GMT]]></title><description><![CDATA[<p>Super es läuft!!! :p</p>
<p>@Braustein</p>
<p>Der LoadFromStream hat mich auf die Idee gebracht, einen TMemoryStream zu testen, da LFS nicht funktioniert hatte.</p>
<pre><code class="language-cpp">TMemoryStream *pMS = new TMemoryStream;
Image1-&gt;Picture-&gt;Graphic-&gt;SaveToStream(pMS);

Form1-&gt;Query1-&gt;Close();
Form1-&gt;Query1-&gt;SQL-&gt;Clear();
Form1-&gt;Query1-&gt;SQL-&gt;Add(&quot;INSERT INTO film (titel, jahr, fsk, laufzeit, genre_id, beschreibung, image) VALUES ('&quot;+Edit1-&gt;Text+&quot;','&quot;+Edit2-&gt;Text+&quot;','&quot;+ Edit3-&gt;Text+&quot;','&quot;+Edit4-&gt;Text+&quot;','&quot;+iRB+&quot;','&quot;+RichEdit1-&gt;Text+&quot;',:imageblob)&quot;);
Form1-&gt;Query1-&gt;Params-&gt;ParamByName(&quot;imageblob&quot;)-&gt;LoadFromStream(pMS,ftBlob); 
Form1-&gt;Query1-&gt;ExecSQL();

delete pMS;
</code></pre>
<p>Ohne Deine Hilfe mit <strong>:imageblob</strong>, würde ich aber immer noch hier sitzen und versuchen mir den Kopf zu zerbrechen.</p>
<p>SUPER FORUM, SUPER LEUTE!!!</p>
<p>Vielen Dank an alle!!!!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1161857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1161857</guid><dc:creator><![CDATA[1753]]></dc:creator><pubDate>Thu, 26 Oct 2006 12:09:12 GMT</pubDate></item></channel></rss>