07 Jan 2006
09 Jan 2006)
Exchange blobs (binary large objects) with MySQL databases
|myblob_command (ado_connection, command)
function cell_array = myblob_command (ado_connection, command)
%MYBLOB_COMMAND Send an SQL statement to a MySQL database
% CELL_ARRAY = MYBLOB_COMMAND (CONNECTION, COMMAND)
% sends the SQL statement string COMMAND to the MySQL database.
% CONNECTION is the handle to the ADODB connection object;
% it is returned by a previous call to MYBLOB_OPEN.
% Results from a SELECT statement are returned in CELL_ARRAY.
% See also: myblob_demo, myblob_open, myblob_from_db, myblob_to_db, myblob_close.
% Joerg J. Buchholz, Hochschule Bremen, email@example.com
% Version 1.0 (2006-01-07)
% Instantiate ADO command object
ado_command = actxserver ('ADODB.Command');
% Communicate the sql command string to the command object
ado_command.CommandText = command;
% Communicate the connection object to the command object
ado_command.ActiveConnection = ado_connection;
% Instantiate ADO record set object
ado_recordset = actxserver ('ADODB.Recordset');
% Communicate the command object to the record set object
% and open the record set object
% Suppress output if anything goes wrong
% (empty record set, closed record set , ...)
% Read the whole table (including blobs) into one big cell array
cell_array = ado_recordset.GetRows;
% Close record set object
% If anything went wrong return an empty set
cell_array = ;