[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-21 Thread Rooney, Joe
Ok, Kyle McKay responded directly offline with the solution.

On my call:
NSData *picData;


sqlite3_bind_blob(preparedStatement, empProfPicDataPos, [picData bytes], 
picBytes, SQLITE_TRANSIENT);


I had originally used picData, not [picData bytes].


And therein lies the fact that given I rarely use NSData, inexperience rules 
the day.


Many thanks to Kyle... and I'd also like to thank myself for learning Forth 
some 36 years ago and the ease of working with pointers. :)



Joseph Rooney
Mobile Development

CommScope, Inc.
Hickory, NC
828-315-2920 Ext: 52920



From: Joseph Rooney mailto:joseph.roo...@commscope.com>>
Date: Monday, January 18, 2016 at 6:46 PM
To: "sqlite-users at mailinglists.sqlite.org" mailto:sqlite-users at mailinglists.sqlite.org>>
Subject: Retrieved Blob Data has 16 Byte Header or ?

The process, working in iOS:


? Retrieve an employee photo using web service call, encoded in Base64 
string

? Convert Base64 string to NSData object - 3245 bytes

? Store NSData object to a Blob in SQLite - 3245 bytes

? Retrieve Blob to NSData object - 3245 bytes

? The retrieved data will not display.

? In comparing the hex input and retrieved output, I find there are 16 
bytes added to the head of the data and I'm 16 bytes short.

? If I add the 16 bytes to the total when storing the data and then 
read back 3245 bytes at the location ptr + 16 bytes, I've got my proper data, 
which displays as normal.

Anyone have any insights into this?

_

Joseph Rooney
Mobile Development
Commscope, Inc.
Hickory, NC
828-315-2920 Ext: 52920



[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-19 Thread Christian Schmitz

> NSData doesn't involve encryption, but it does involve tagging the data with 
> metadata, e.g. the fact that it's a string, and how long the string is.
> There is an NSData accessor function which returns the length of the 
> /content/ of the object.  Or, of course, you can obtain the length of the 
> object itself.  My guess is that somewhere in the code these one of these is 
> being used where it should be the other.

Without seeing his code, it doesn't make sense guess what might be wrong.

Sincerely
Christian

-- 
Read our blog about news on our plugins:

http://www.mbsplugins.de/



[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-19 Thread Christian Schmitz

> * Retrieve Blob to NSData object - 3245 bytes
> 
> * The retrieved data will not display.


Do you pass it though encryption?

16 bytes sounds like an IV for AES stored before the data.

Sincerely
Christian

-- 
Read our blog about news on our plugins:

http://www.mbsplugins.de/



[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-19 Thread Simon Slavin
On 19 Jan 2016, at 9:13am, Christian Schmitz  wrote:

>> * Retrieve Blob to NSData object - 3245 bytes
>> 
>> * The retrieved data will not display.
> 
> Do you pass it though encryption?
> 
> 16 bytes sounds like an IV for AES stored before the data.

NSData doesn't involve encryption, but it does involve tagging the data with 
metadata, e.g. the fact that it's a string, and how long the string is.

There is an NSData accessor function which returns the length of the /content/ 
of the object.  Or, of course, you can obtain the length of the object itself.  
My guess is that somewhere in the code these one of these is being used where 
it should be the other.

Simon.


[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-19 Thread Hick Gunter
Just a wild guess: The NSData object has an overhead of 16 bytes and the 
(overloaded/member?) sizeof() function returns the NET contents, not the total 
size which should be 16 bytes (the overhead) longer.

-Urspr?ngliche Nachricht-
Von: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-bounces at mailinglists.sqlite.org] Im Auftrag von Rooney, 
Joe
Gesendet: Dienstag, 19. J?nner 2016 00:46
An: sqlite-users at mailinglists.sqlite.org
Betreff: [sqlite] Retrieved Blob Data has 16 Byte Header or ?

The process, working in iOS:


* Retrieve an employee photo using web service call, encoded in Base64 
string

* Convert Base64 string to NSData object - 3245 bytes

* Store NSData object to a Blob in SQLite - 3245 bytes

* Retrieve Blob to NSData object - 3245 bytes

* The retrieved data will not display.

* In comparing the hex input and retrieved output, I find there are 16 
bytes added to the head of the data and I'm 16 bytes short.

* If I add the 16 bytes to the total when storing the data and then 
read back 3245 bytes at the location ptr + 16 bytes, I've got my proper data, 
which displays as normal.

Anyone have any insights into this?

_

Joseph Rooney
Mobile Development
Commscope, Inc.
Hickory, NC
828-315-2920 Ext: 52920

___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.




[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-19 Thread Simon Slavin

On 18 Jan 2016, at 11:46pm, Rooney, Joe  wrote:

> * Convert Base64 string to NSData object - 3245 bytes
> 
> * Store NSData object to a Blob in SQLite - 3245 bytes
> 
> * Retrieve Blob to NSData object - 3245 bytes
> 

Store the string in the BLOB rather than the NSData object.  I suspect that 
some part in your conversion is adding the extra 16 bytes.

Simon.


[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-18 Thread Rooney, Joe
The process, working in iOS:


* Retrieve an employee photo using web service call, encoded in Base64 
string

* Convert Base64 string to NSData object - 3245 bytes

* Store NSData object to a Blob in SQLite - 3245 bytes

* Retrieve Blob to NSData object - 3245 bytes

* The retrieved data will not display.

* In comparing the hex input and retrieved output, I find there are 16 
bytes added to the head of the data and I'm 16 bytes short.

* If I add the 16 bytes to the total when storing the data and then 
read back 3245 bytes at the location ptr + 16 bytes, I've got my proper data, 
which displays as normal.

Anyone have any insights into this?

_

Joseph Rooney
Mobile Development
Commscope, Inc.
Hickory, NC
828-315-2920 Ext: 52920



[sqlite] Retrieved Blob Data has 16 Byte Header or ?

2016-01-18 Thread Richard Hipp
On 1/18/16, Rooney, Joe  wrote:
> The process, working in iOS:
>
>
> * Retrieve an employee photo using web service call, encoded in
> Base64 string
>
> * Convert Base64 string to NSData object - 3245 bytes
>
> * Store NSData object to a Blob in SQLite - 3245 bytes
>
> * Retrieve Blob to NSData object - 3245 bytes
>
> * The retrieved data will not display.
>
> * In comparing the hex input and retrieved output, I find there are
> 16 bytes added to the head of the data and I'm 16 bytes short.
>
> * If I add the 16 bytes to the total when storing the data and then
> read back 3245 bytes at the location ptr + 16 bytes, I've got my proper
> data, which displays as normal.
>
> Anyone have any insights into this?

I suspect something is wrong with your application, or perhaps with
the wrapper you are using to access SQLite (assuming you are not
accessing SQLite directly).  It is difficult to say exactly what might
be wrong without seeing more information.

SQLite has never been known to shift BLOB content by 16 bytes before.

-- 
D. Richard Hipp
drh at sqlite.org