Re: Copying Binary data from one table to another



Debug what? Heres the testing thing i've broken it down to.

The original table
[code]
CREATE TABLE `binary_a` (
`org_a` tinyblob NOT NULL,
`org_b` blob NOT NULL,
`org_c` tinyint(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
[/code]

The one i'm trying to copy to
[code]
CREATE TABLE `binary_b` (
`copy_a` tinyblob NOT NULL,
`copy_b` blob NOT NULL,
`copy_c` tinyint(1) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
[/code]

The Sql to create the binary stuff:
[code]
insert into binary_a (org_a,org_b,org_c) values
(aes_encrypt('norman','mongo'),aes_encrypt('mink','mongo'),1)
[/code]

The ASP:
[code]
set original = Cecexe.execute("select org_a,org_b,org_c from binary_a")

if original.eof and original.bof then
Response.Write("Did not find data to print")
else
do while not original.eof
'Response.Write original("org_a")&" "&original("org_b")&" "&original("org_c")
CecExe.Execute("insert into binary_b (copy_a,copy_b,copy_c) values
('"&original("org_a")&"', '"&original("org_b")&"', "&original("org_c")&") ")
original.MoveNext
loop

End If
[/code]



"Evertjan." wrote:

=?Utf-8?B?bm9ybWFucA==?= wrote on 06 mrt 2008 in
microsoft.public.inetserver.asp.db:

"Bob Barrows [MVP]" wrote:

normanp wrote:
Hi,

I have these tables with binary data stored in tinyblobs and blobs
in MySql. In my application I sometimes need to copy them to
another table. Not all the data, maybe just a column or two. So I
first select the data into a record set and then loop and insert it
(its the only way can do it)

I've never worked with mysql, but this statement would make me
absolutely reject it as a database-of-choice if I was ever
considering it. Are you sure this is the only way? Can't you do a
simple "INSERT INTO tablename (<column list>) SELECT <column list>
FROM othertable" in MySQL?

[Please do not toppost on usenet]

Thanks. Unfortunately there is no other way for me to do this. I have
to select then insert. Because sometimes i may need a few columns and
sometime others. Its hard for me to put it in words. But I think
you'll understand.

By why will binary stuff not work?

However:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

seems to suggest, the error is not database related, but vbs code.

Start debugging!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

.



Relevant Pages

  • XML to mySQL - Loop issue?
    ... I am trying to loop through a ... XML feeds, pull out some info and place it into a mySQL table. ...
    (comp.lang.php)
  • Re: XML to mySQL - Loop issue?
    ... I am trying to loop through a ... XML feeds, pull out some info and place it into a mySQL table. ...
    (comp.lang.php)
  • Re: XML to mySQL - Loop issue?
    ... I am trying to loop through a ... XML feeds, pull out some info and place it into a mySQL table. ...
    (comp.lang.php)
  • Re: Looping from a fetcharray()
    ... need to do, is loop through the array, displaying each company name. ... // Assumes $result is MySQL Result Resource ... // Assumes $NumRows has already been populated with number of return ...
    (comp.lang.php)
  • Re: stuck on 1 shell variable, not re-updating.
    ... > I have created this shell script, it updates a specific table on a ... > mysql db. ... Haven't tried it but this loop doesn't do anything. ... -- Thomas Adam ...
    (Debian-User)

Loading