This is a design question  really so here are my recomendations.
 
 Persons
 - ID                ( an integer primary key )
   - Name
   - Birthday
   - Picture Type ( your two digit type).
 
 Picture
 - ID             (An integer Primary Key that matches the ID of persons).
 - image     (blob)
 
 Thus if you alread have the Persons record, you can get the picture as a 
simple select on the Picture.image field by 
 
   select image from Picture where id = ?   
 

Stef Mientki <[EMAIL PROTECTED]> wrote: 

Cesar Rodas wrote:
> Save into a blob.
>
thanks but that's not what I meant.
I'll try to explain with an example:

I want to create this database

Persons
  - Name
  - Birthday
  - Picture

Now when I want to view this database with a general database browser / 
manager,
I'll first find out what tables there are in this database,
Secondly I'm going to ask for an overview of each table by, that will be 
displayed in a flat table (2-dimensional matrix)
  SELECT   *   FROM   Persons
Now the browser sees the blob field at displays  is something like "{blob}"

So I assume, that the browser get's all the data, including all the bits 
and bytes of each image in each record,
so a whole lot of not-needed data, because the database browser / 
manager can con display 1 picture from a selected record.

So I think, it would be more efficient to create 2 tables:

Persons
  - Name
  - Birthday
  - ID ("this is a picture")

Blobs
  - Name
  - Picture

Now if I ask for the main table "Persons", I just get an ID (some 
integer), that tells me that there is a picture.
The browser / manager can ask for just one record from the table Blobs, 
to show me the picture of the selected line.

I've never seen such a construct in examples, so maybe I see ghosts 
where there are none.

forgive me my ignorance.
cheers,
Stef Mientki


> here is a C example http://www.sqlite.org/cvstrac/wiki?p=BlobExample
>
> On 23/02/07, Stef Mientki  wrote:
>> hello,
>>
>> I've started with SQLite, because it's one of the first dbases with a
>> local filessytem without authenciation.
>> It looks great, compared to ini-files.
>>
>> Now I've a basic problem:
>> I've a table, with 10 simple fields and 1 blob field, containing a
>> (possibly large) image.
>> Uptill now the dbase is small so no performance problems yet.
>> But what if it grows ?
>>
>> I want to look at the table in a table overview,
>> where the blob-field just displays the type of image
>> (identified by the fisrt 2 bytes SOI-code).
>>
>> When I ask for the table through a query,
>> I get all the blob-filed information, while I only need the first 2 
>> bytes,
>> and only the full picture of 1 selected record.
>>
>> I can think of several solutions, but as my experience with databases is
>> almost zero, I can't decide
>> (and maybe I'm overlooking some better solutions)
>> solution 1:
>> add a extra field for each blob field, filled with the first 2 bytes of
>> a blob
>> solution 2:
>> put the blob fields in a separate table, with a link to the main table
>>
>> any suggestions would be appreciated.
>> thanks,
>> Stef Mientki
>>
>> -----------------------------------------------------------------------------
>>  
>>
>> To unsubscribe, send email to [EMAIL PROTECTED]
>> -----------------------------------------------------------------------------
>>  
>>
>>
>>
>
>

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------


Reply via email to