Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to copy a blob field into an array of bytes
Message
 
À
22/03/2011 18:12:45
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01504022
Message ID:
01504607
Vues:
59
>Are you saying that when you create the VFP remote view and select BLOB as the data type, the view instead creates a general field type when you run the query?
>

I can use FlameRobin to view the structure of the original database. It is a blob. What I know is that it does contain binary data collected from a measurement system: all 8-bit A/D values.

I create an ODBC data source using a Firebird driver.

In VFP, CREATE SQL VIEW, etc. The Select statement in that view just selects that field.

I know know in the resulting view, that field is identified in VFP as General.

Jim

>
>>>Where do you get the error? In the substr() loop?
>>>
>>>Also, have you tried assigning the blob to a variable and referencing the var in the substr()?
>>>
>>>Gary
>>
>>Gary,
>>
>>If I try assigning BlobData to a local variable, I get an error saying that the operation is not valid for a General field.
>>
>>So BlobData is a general field, not a blob.
>>
>>I assume that the blob data is in that general field. How do I get it out into a byte array?
>>
>>Thanks,
>>Jim
>>
>>>
>>>>>>>>>>>How to copy the contents of a blob field in a table into an array of bytes.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>VFP doesn't have byte data type. Please clarify.
>>>>>>>>>
>>>>>>>>>It does *sortof*. I've defined arrays as byte (DIME aTest[100] as BYTE, aTest = 'X') to pass to COM servers and they are recognized as VT_UI1. TYPE() in VFP returns 'N'. I guess it depends on what the array is to be used for.
>>>>>>>>
>>>>>>>>
>>>>>>>>Sergey & Gary,
>>>>>>>>
>>>>>>>>Thanks for responding to my posting.
>>>>>>>>
>>>>>>>>Actually, my purpose has to do with COM. I'm developing a COM server. The client will pass a reference (pointer) to a byte array to the COM sever. The COM server will transfer the data from the blob field into the byte array.
>>>>>>>>
>>>>>>>>So, how, in my VFP COM server can I transfer the data from the blob into the byte array?
>>>>>>>>
>>>>>>>>Looks like VFP Dimension statement knows about the Byte data type, by the CAST function does not.
>>>>>>>>
>>>>>>>>Thanks,
>>>>>>>>Jim
>>>>>>>
>>>>>>>
>>>>>>>Does something like the following work?
>>>>>>>
>>>>>>>DIME MyPassedArray[LEN(MyBlob)]
>>>>>>>
>>>>>>>FOR nInc = 1 TO LEN(MyBlob)
>>>>>>> MyPassedArray[nInc]=SUBSTR(MyBlob,nInc,1)
>>>>>>>ENDFOR
>>>>>>
>>>>>>Gary,
>>>>>>I just got to try your suggestion. The blob field is part of a view. When I try the code you suggest:
>>>>>>
>>>>>> FOR nIx = 1 TO nBlobSize
>>>>>> nBlobData[nIx] = SUBSTR(BlobData, nIx, 1)
>>>>>> ENDFOR
>>>>>>
>>>>>>Where, BlobData is the name of the blob field in the view. I get the following error message:
>>>>>>
>>>>>> Function argument value, type, or count is invalid
>>>>>>
>>>>>>I get the sam error if I use vMyView.BlobData as the first argument.
>>>>>>Again, thanks for your suggestions.
>>>>>>Jim
>>>>>
>>>>>What is the type of the BlobData field?
>>>>
>>>>Naomi,
>>>>It is a blob in the original database from which I create the view. BlobData is the name of the field in the VFP view. VARTYPE(BlobData) returns "G". Does that mean that it is no longer a blob?
>>>>In any case, I am trying to get the binary data out of that blob field.
>>>>In the view, I just changed the field to say CAST(myBlobField AS BLOB) AS BlobData.But, VARTYPE(BlobData) still returns "G:
>>>>
>>>>The original database is Firebird.I use a VFP parametrized view to get a specific record in the table, and now want to get the blob field in that record.
>>>>
>>>>Hmmm
>>>>
>>>>Jim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform