Problems Using Bitmap in Postgress

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Problems Using Bitmap in Postgress

#1 Post by digitsoft »

Hi Al Group
Alguin know how to save a JPG in a Table in Postgress

I am using this but it does not work when I want to present
cfoto: = __b64enc (MEMOREAD (cFotoFile)) //ot4xb.dll Paul

I think if the file again with the image looks good in the file
MEMOWRIT ( "C: \ LOGS \ Foto.jpg" __b64dec (cfoto))

but if what I want is to paint the picture with DC_BitMapDraw (oMarcoFoto, __b64dec (cfoto))

no nothing.
Nolberto Paulino
Regards

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Problems Using Bitmap in Postgress

#2 Post by Auge_Ohr »

hi,

did you talk about Xbase++ PgDBE or native Access using libpq.dll ?

also remember PDR 6009 : 14 Byte from Bitmap Header are missing when using o:SetBuffer()
greetings by OHR
Jimmy

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: Problems Using Bitmap in Postgress

#3 Post by digitsoft »

I am using SQL Express Demo and xBase 1.9.355, and I want to know how to add a photo on a table and then show postgress
Nolberto Paulino
Regards

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Problems Using Bitmap in Postgress

#4 Post by Auge_Ohr »

PostgreSQL Table have Type "BLOB" and "bytea" to store binary Data.

i think Sqlexpress use Postgres ODBC ... ask Boris what Format can be used by ODBC

i use "bytea" with XbpBitmap() and cBin2Hex() / cHex2Bin() from ot4xb

"store" to PG

Code: Select all

      oBMP := XBPBITMAP() :new() :create()
      oBMP:loadFile( cFile )
      cBuffer := oBMP:setbuffer()

      // cBuffer missing 14 byte Header need workaround
      //
      cSql   += ::_aBroFields[ nCol ] [ DBS_NAME ] + "= '\x" + cBin2Hex( cBuffer ) + "' "
      cAlias := ::_aBroFields[ nCol ] [ DBS_ALIAS ] + "."
      cWhere := cAlias + "__record" + "=" + STR( nRecord )
      cSql   += " WHERE " + cWhere
"load" from PG

Code: Select all

      cFeld := ::oResult:getValue( nRow - 1, nCol - 1 )

      // strip "\x" 
      //
      IF SUBSTR( cFeld, 1, 2 ) = "\x"
         cFeld := SUBSTR( cFeld, 3, LEN( cFeld ) - 2 )
      ENDIF
 
      oPS := XBPPRESSPACE() :new() :create( oDlg:drawingArea:winDevice() )
      oBMP := XBPBITMAP() :new() :create( oPS )

      // Hex to Bin Format using ot4xb
      //
      oBMP:setBuffer( cHex2Bin( cFeld ) )
greetings by OHR
Jimmy

User avatar
digitsoft
Posts: 451
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: Problems Using Bitmap in Postgress

#5 Post by digitsoft »

Hi Jimmy
Where you can get this 2 functions
cBin2Hex()
cHex2Bin()

Remember that I am using xBase 1.9.355
Nolberto Paulino
Regards

Leon Berger
Posts: 36
Joined: Thu Jan 28, 2010 2:30 pm

Re: Problems Using Bitmap in Postgress

#6 Post by Leon Berger »

digitsoft wrote:Where you can get this 2 functions
cBin2Hex()
cHex2Bin()
You can get it here (free):
http://ot4xb.xbwin.com
Best regards
Leon

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Problems Using Bitmap in Postgress

#7 Post by Tom »

You may also use StrToHex/HexToStr from the Xbase Tools, free in Xbase++ 2.0 or higher. ;) They work for binaries aswell.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Problems Using Bitmap in Postgress

#8 Post by rdonnay »

You can also use DC_Var2HexString() and DC_HexString2Var().
The eXpress train is coming - and it has more cars.

Post Reply