Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Image in database
Re: Image in database [message #31934 is a reply to message #31932] Fri, 08 April 2011 21:10 Go to previous messageGo to previous message
Didier is currently offline  Didier
Messages: 725
Registered: November 2008
Location: France
Contributor
Hi jibe,

I use a helper class in one of my apps.

It can be used with the following SQL schema description:
// ========================================
//          IMAGES
// ========================================
TABLE_(IMAGES)
	INT_	(IMG_ID) PRIMARY_KEY AUTO_INCREMENT
	INT_	(IMG_HASH)  INDEX
	INT_    (IMG_REFCOUNT) SQLDEFAULT(0) // reference counter
	LONGRAW_(IMG_DATA)
END_TABLE


NB: The hash and REFCOUNT are not used yet, they are intended for future devs.

The idea is to have all images in one table and manage references to these images in the other tables:
TABLE_(CLUBS)
	INT_    (CLUB_ID) PRIMARY_KEY AUTO_INCREMENT
	STRING_ (CLUB_NUMBER, 10)
	STRING_ (CLUB_NOM, 60)
	STRING_ (CLUB_ALIAS, 10)
	STRING_ (CLUB_ADRESSE, 250)
	STRING_ (CLUB_VILLE, 30)
	INT_    (CLUB_CODE_POSTAL)
	STRING_ (CLUB_NUM_TEL, 20)
	INT_    (CLUB_REF_LIGUE) REFERENCES(LIGUE)
	INT_    (CLUB_LOGO_SMALL_IMGREF)  SQLDEFAULT(-1)     **** IMAGE ****
	INT_    (CLUB_LOGO_BIG_IMGREF)    SQLDEFAULT(-1)     **** IMAGE ****
	STRING_ (CLUB_MAIL, 50)
END_TABLE


In order to use it you finally need to do something like this:

clubsData.CLUB_LOGO_BIG_IMGREF = ImageMgr::addImage( clubCtrls.imgPresentation.GetImage() );

or

clubCtrls.imgPresentation.SetData( ImageMgr::getImageString( clubsData.CLUB_LOGO_SMALL_IMGREF ) );



Hope this will be useful for you
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is this really a GUI RAD?
Next Topic: Tell me more about U++ please.
Goto Forum:
  


Current Time: Mon Apr 28 01:13:26 CEST 2025

Total time taken to generate the page: 0.00500 seconds