I want to save a Blob in a table using a stored procedure.
I've tried all sorts of things but it won't work: the blob to insert is always NULL and as a result of that the insert fails because the column is defined NOT NULL.
Is it possible to use Blob parameters for stored procedures with MyDAC (and SDAC ..)?
[code]
p := MyStoredProc1.ParamByName('aance');
p.DataType := ftSTring;
p.AsString := '00005';
p := MyStoredProc1.ParamByName('anttp');
p.DataType := ftSTring;
p.AsString := '123';
p := MyStoredProc1.ParamByName('tkset');
p.DataType := ftSTring;
p.AsString := 'E';
p := MyStoredProc1.ParamByName('tekst');
p.DataType := ftBlob;
ms2.Position := 0;
p.LoadFromStream(ms2, ftBlob);
Memo1.Lines.Add('Size: ' + IntToStr(length(p.AsBlob)) + ' ' + IntToStr(ms2.Size));
MyStoredProc1.ExecProc;
p := MyStoredProc1.ParamByName('fq1id');
p.DataType := ftInteger;
Memo1.Lines.Add(p.AsString);
the stored proc:
CREATE DEFINER=`...`@`....` PROCEDURE `InsertQ1`(in aance varchar(5),
in anttp varchar(5),
in tkset varchar(1),
in tekst blob,
out fq1id integer)
BEGIN
-- insert into table containing some meta-data
insert into drfq1md(deaance, detimst, deanttp, deversi, detkset)
values(aance, now(), anttp, '001', tkset);
-- retrieve file-id
select last_insert_id()
into fq1id;
-- insert blob into dedicated blob-table
insert into drfq1da(defidq1, detext)
values(fq1id, tekst);
END[/code]
I hope someone can tell me how to fix this.
With regards,
Peet
Blob parameter for stored procedure does not work
-
DemetrionQ
- Devart Team
- Posts: 271
- Joined: Wed 23 Jan 2013 11:21
Re: Blob parameter for stored procedure does not work
Hello.
I couldn't reproduce the problem. Please provide the following information:
- the exact IDE, MyDAC, MySQL versions;
- the script for creating tables;
- the size of data you are trying to store in a BLOB field.
I couldn't reproduce the problem. Please provide the following information:
- the exact IDE, MyDAC, MySQL versions;
- the script for creating tables;
- the size of data you are trying to store in a BLOB field.