PC Review


Reply
Thread Tools Rate Thread

Cleaning some blob data

 
 
Andy Kessel
Guest
Posts: n/a
 
      7th Oct 2006
I need to do a little file manipulation with VBA

I am pulling blob data out of ms sql server using text copy, the files
are jpeg files that have had tags added to the front of the file, and
of course could be fairly big.

I know that the actual jpeg begins with a particular 4 characters, so I
could identify how many characters into the file i have the real file
starting.

Now if this was a string, I would just use instr to find the start and
right(x$,len(x$)-instr(1,x$,instr$)) to get the data. But this is too
damn big for that method.

Any suggestions? Do I have to do this character by character? if so I
could use a little help with how.

 
Reply With Quote
 
 
 
 
moon
Guest
Posts: n/a
 
      8th Oct 2006

"Andy Kessel" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
>I need to do a little file manipulation with VBA
>
> I am pulling blob data out of ms sql server using text copy, the files
> are jpeg files that have had tags added to the front of the file, and
> of course could be fairly big.
>
> I know that the actual jpeg begins with a particular 4 characters, so I
> could identify how many characters into the file i have the real file
> starting.
>
> Now if this was a string, I would just use instr to find the start and
> right(x$,len(x$)-instr(1,x$,instr$)) to get the data. But this is too
> damn big for that method.
>
> Any suggestions? Do I have to do this character by character? if so I
> could use a little help with how.
>




Open the file in binary mode and read a group of 4 bytes, instead of
character by character. U can store 4 bytes in a byte array, rather than a
string.

Public Sub ReadJPGHeader()
Dim FileNum As Integer
Dim FileName As String
Dim FileHeader(3) As Byte
FileNum = FreeFile
FileName = "C:\TEST.JPG"
Open FileName For Binary Access Read As FileNum
Get FileNum, , FileHeader
Close FileNum
'MsgBox Hex(FileHeader(0))
'MsgBox Hex(FileHeader(1))
'etc.
End Sub


But after all it's way faster to do this in C++, so a .dll that does the
dirty work, called by VBA.



 
Reply With Quote
 
Andy Kessel
Guest
Posts: n/a
 
      8th Oct 2006
I would agree, it would be better to have in a dll. Just currently
beyond my tools set.
Problem is that I have to do this with a bunch of files, so it would be
particularly useful to have a faster routine. I wish our database
software, didn't add the extra info to the front of the jpeg, then I
wouldn't have this problem.

If interested in writing such a thing, let me know - I could give you
more to work with, and let you price it for me. If interested email me
at (E-Mail Removed).

Thanks, Andy


> Open the file in binary mode and read a group of 4 bytes, instead of
> character by character. U can store 4 bytes in a byte array, rather than a
> string.
>
> Public Sub ReadJPGHeader()
> Dim FileNum As Integer
> Dim FileName As String
> Dim FileHeader(3) As Byte
> FileNum = FreeFile
> FileName = "C:\TEST.JPG"
> Open FileName For Binary Access Read As FileNum
> Get FileNum, , FileHeader
> Close FileNum
> 'MsgBox Hex(FileHeader(0))
> 'MsgBox Hex(FileHeader(1))
> 'etc.
> End Sub
>
>
> But after all it's way faster to do this in C++, so a .dll that does the
> dirty work, called by VBA.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Showing BLOB data Piotr Microsoft Excel Discussion 0 27th Dec 2005 02:15 PM
printing blob data asp.net coynej60 Microsoft ASP .NET 0 12th Oct 2005 01:30 PM
Displaying blob data in a picturebox =?Utf-8?B?d3NjaGxpY2h0bWFu?= Microsoft C# .NET 1 20th Sep 2005 06:00 AM
Displaying BLOB data Jeff C. Microsoft Access Queries 3 12th Nov 2003 10:58 PM
Adding BLOB data via sql exec Pavils Jurjans Microsoft Access Queries 0 6th Nov 2003 05:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:21 PM.