Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Blob as Integer[]??

6 posts in EJB Client Last posting was on 2005-01-05 09:22:47.0Z
Ben (bede) Posted on 2004-09-15 09:19:19.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Blob as Integer[]??
Message-ID: <MPG.1bb22542e01236039896a2@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
Date: 15 Sep 2004 02:19:19 -0700
X-Trace: forums-1-dub 1095239959 194.7.38.226 (15 Sep 2004 02:19:19 -0700)
X-Original-Trace: 15 Sep 2004 02:19:19 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 91
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:361
Article PK: 424535

Hi,

using PB9.0.1#7236

apparently what used to be blob in CORBA has now become blob masked as
an integer array.

i got some questions about this:
- is this because the blob is treated as a byte-array (byte, being
integer here?)
- How can i cast a blob into it properly?

<CodeStart>
Blob lblb_file
Any la_blob
Integer li_blob[]

/* a file is being loaded into lblb_file */

// Mask blob as integer array
la_blob = lblb_file
li_blob = la_blob

<CodeEnd>

Thx for any clarification,

Ben.

below is ejb2pb9 exported proxy object, as you can see the blob is
passed as integer array.


$PBExportHeader$java_DocumentBlobSessPar.srx
$PBExportComments$Java Proxy for class:
be.sofico.basecamp.sess.document.DocumentBlobSessPar
global type java_DocumentBlobSessPar from nonvisualobject
end type

type variables
protected:
string java_DocumentBlobSessPar_javaname=
"be.sofico.basecamp.sess.document.DocumentBlobSessPar"
java_ISofParameter i__java_DocumentBlobSessPar__java_ISofParameter

public:
indirect any theBlob { __set_theBlob(*value), __get_theBlob() }
indirect java_SofError theError { __set_theError(*value), __get_theError
() }
indirect string theFileName { __set_theFileName(*value),
__get_theFileName() }
indirect java_SofMLStringPar theMlStrings { __set_theMlStrings(*value),
__get_theMlStrings() }
end variables

forward prototypes
private:
function java_SofMLStringPar __get_theMlStrings() alias for
"R:theMlStrings,Lbe/sofico/basecamp/sys/multilanguage/SofMLStringPar;"
subroutine __set_theMlStrings( java_SofMLStringPar theMlStrings) alias
for
"W:theMlStrings,Lbe/sofico/basecamp/sys/multilanguage/SofMLStringPar;"
function java_SofError __get_theError() alias for
"R:theError,Lbe/sofico/basecamp/parameter/SofError;"
subroutine __set_theError( java_SofError theError) alias for
"W:theError,Lbe/sofico/basecamp/parameter/SofError;"
function any __get_theBlob() alias for "R:theBlob,[B|int"
subroutine __set_theBlob( int theBlob[]) alias for "W:theBlob,[B"
function string __get_theFileName() alias for
"R:theFileName,Ljava/lang/String;"
subroutine __set_theFileName( string theFileName) alias for
"W:theFileName,Ljava/lang/String;"

public:
subroutine java_DocumentBlobSessPar() alias for "<init>,()V"
function java_SofMLStringPar getMLStrings() alias for "getMLStrings,()
Lbe/sofico/basecamp/sys/multilanguage/SofMLStringPar;"
function java_SofError getError() alias for "getError,()
Lbe/sofico/basecamp/parameter/SofError;"
function any getSofParameters() alias for "getSofParameters,()
[Lbe/sofico/basecamp/general/ISofParameter;|java_ISofParameter"
subroutine setMLStrings( java_SofMLStringPar java_SofMLStringPar_1)
alias for "setMLStrings,
(Lbe/sofico/basecamp/sys/multilanguage/SofMLStringPar;)V"
subroutine setError( java_SofError java_SofError_1) alias for
"setError,(Lbe/sofico/basecamp/parameter/SofError;)V"
subroutine setReadonlyCruds() alias for "setReadonlyCruds,()V"
function any getMainObjectIds() alias for "getMainObjectIds,()[I"
function long getMainSysRepObjectId() alias for "getMainSysRepObjectId,
()I"
end prototypes


Ben (bede) Posted on 2004-09-15 10:28:53.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Blob as Integer[]??
Message-ID: <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com>
References: <MPG.1bb22542e01236039896a2@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-Trace: 15 Sep 2004 03:36:14 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 68
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 15 Sep 2004 03:16:47 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 15 Sep 2004 03:28:53 -0700
X-Trace: forums-1-dub 1095244133 10.22.108.75 (15 Sep 2004 03:28:53 -0700)
X-Original-Trace: 15 Sep 2004 03:28:53 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:362
Article PK: 424536

just tried that technique with the integer array

result is this error:

RuntimeError: Array expected in ANY variable at line 98 in clicked event
of object cb_import of u_document.

maybe through (BlobToString) and then making it into an integer array..

but this is taking it too far, isn't it?

am i overlooking something or should blob remain blob?
if the latter.. what could have gone wrong with the proxy generation??



In article <MPG.1bb22542e01236039896a2@forums.sybase.com>,
bedeNOSP@Msofico.be says...

> Hi,
>
> using PB9.0.1#7236
>
> apparently what used to be blob in CORBA has now become blob masked as
> an integer array.
>
> i got some questions about this:
> - is this because the blob is treated as a byte-array (byte, being
> integer here?)
> - How can i cast a blob into it properly?
>
> <CodeStart>
> Blob lblb_file
> Any la_blob
> Integer li_blob[]
>
> /* a file is being loaded into lblb_file */
>
> // Mask blob as integer array
> la_blob = lblb_file
> li_blob = la_blob
>
> <CodeEnd>
>
> Thx for any clarification,
>
> Ben.
>
> below is ejb2pb9 exported proxy object, as you can see the blob is
> passed as integer array.
>
>
> $PBExportHeader$java_DocumentBlobSessPar.srx
> $PBExportComments$Java Proxy for class:
> be.sofico.basecamp.sess.document.DocumentBlobSessPar
> global type java_DocumentBlobSessPar from nonvisualobject
> end type
>
> type variables
> protected:
> string java_DocumentBlobSessPar_javaname=
> "be.sofico.basecamp.sess.document.DocumentBlobSessPar"
> java_ISofParameter i__java_DocumentBlobSessPar__java_ISofParameter
>
> public:
> indirect any theBlob { __set_theBlob(*value), __get_theBlob() }
> indirect java_SofError theError { __set_theError(*value), __get_theError
> () }
> indirect string theFileName { __set_theFileName(*value),


Ben (bede) Posted on 2004-09-15 12:09:57.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Blob as Integer[]??
Message-ID: <MPG.1bb24d2ead32cdff9896a7@forums.sybase.com>
References: <MPG.1bb22542e01236039896a2@forums.sybase.com> <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-Trace: 15 Sep 2004 05:17:19 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 74
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 15 Sep 2004 04:57:50 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 15 Sep 2004 05:09:57 -0700
X-Trace: forums-1-dub 1095250197 10.22.108.75 (15 Sep 2004 05:09:57 -0700)
X-Original-Trace: 15 Sep 2004 05:09:57 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:363
Article PK: 424538

the next plan was this: convert the blob to string and convert the
string to int[]

however, after putting a file (like a bitmap or something) into the
blob, the String(blob) is only a few garbage-like characters..

i'm using blobs of hundreds/thousands of bytes length.
dunno how it gets to a string of only 10 characters.

ls_blob = String(lblb_file)
ls_blob = String(BlobMid(lblb_file, 1))

// Convert to int[]
Long ll_len
For ll_len = 1 To Len(ls_blob)
li_blob[ll_len] = Asc(mid(ls_blob, ll_len, 1))
Next


duh.. and it's not even Monday anymore!


In article <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com>,
bedeNOSP@Msofico.be says...

> just tried that technique with the integer array
>
> result is this error:
>
> RuntimeError: Array expected in ANY variable at line 98 in clicked event
> of object cb_import of u_document.
>
> maybe through (BlobToString) and then making it into an integer array..
>
> but this is taking it too far, isn't it?
>
> am i overlooking something or should blob remain blob?
> if the latter.. what could have gone wrong with the proxy generation??
>
>
>
> In article <MPG.1bb22542e01236039896a2@forums.sybase.com>,
> bedeNOSP@Msofico.be says...
> > Hi,
> >
> > using PB9.0.1#7236
> >
> > apparently what used to be blob in CORBA has now become blob masked as
> > an integer array.
> >
> > i got some questions about this:
> > - is this because the blob is treated as a byte-array (byte, being
> > integer here?)
> > - How can i cast a blob into it properly?
> >
> > <CodeStart>
> > Blob lblb_file
> > Any la_blob
> > Integer li_blob[]
> >
> > /* a file is being loaded into lblb_file */
> >
> > // Mask blob as integer array
> > la_blob = lblb_file
> > li_blob = la_blob
> >
> > <CodeEnd>
> >
> > Thx for any clarification,
> >
> > Ben.
> >
> > below is ejb2pb9 exported proxy object, as you can see the blob is
> > passed as integer array.
> >


Ben (bede) Posted on 2004-09-15 12:18:36.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: How to pass a blob?
Message-ID: <MPG.1bb24f41d7fe14039896a8@forums.sybase.com>
References: <MPG.1bb22542e01236039896a2@forums.sybase.com> <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com> <MPG.1bb24d2ead32cdff9896a7@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-Trace: 15 Sep 2004 05:25:55 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 64
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 15 Sep 2004 05:06:26 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 15 Sep 2004 05:18:36 -0700
X-Trace: forums-1-dub 1095250716 10.22.108.75 (15 Sep 2004 05:18:36 -0700)
X-Original-Trace: 15 Sep 2004 05:18:36 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:364
Article PK: 424541

just found out this.. (thx Roy)
"You can't convert a blob to a string -- even with the String( blob )
function -- as the resulting string will be truncated at the first null
character in the blob. Instead, you should use the BlobMid() and
BlobEdit() functions to parse the information stored in the blob."

At least i've got an idea what's going wrong, but it doesn't take me
much closer to a solution.

Any ideas?


In article <MPG.1bb24d2ead32cdff9896a7@forums.sybase.com>,
bedeNOSP@Msofico.be says...

> the next plan was this: convert the blob to string and convert the
> string to int[]
>
> however, after putting a file (like a bitmap or something) into the
> blob, the String(blob) is only a few garbage-like characters..
>
> i'm using blobs of hundreds/thousands of bytes length.
> dunno how it gets to a string of only 10 characters.
>
> ls_blob = String(lblb_file)
> ls_blob = String(BlobMid(lblb_file, 1))
>
> // Convert to int[]
> Long ll_len
> For ll_len = 1 To Len(ls_blob)
> li_blob[ll_len] = Asc(mid(ls_blob, ll_len, 1))
> Next
>
>
> duh.. and it's not even Monday anymore!
>
>
> In article <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com>,
> bedeNOSP@Msofico.be says...
> > just tried that technique with the integer array
> >
> > result is this error:
> >
> > RuntimeError: Array expected in ANY variable at line 98 in clicked event
> > of object cb_import of u_document.
> >
> > maybe through (BlobToString) and then making it into an integer array..
> >
> > but this is taking it too far, isn't it?
> >
> > am i overlooking something or should blob remain blob?
> > if the latter.. what could have gone wrong with the proxy generation??
> >
> >
> >
> > In article <MPG.1bb22542e01236039896a2@forums.sybase.com>,
> > bedeNOSP@Msofico.be says...
> > > Hi,
> > >
> > > using PB9.0.1#7236
> > >
> > > apparently what used to be blob in CORBA has now become blob masked as
> > > an integer array.
> > >
> > > i got some questions about this:


Ben (bede) Posted on 2004-09-16 07:11:32.0Z
From: Ben (bede) <bedeNOSP@Msofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: How to pass a blob?
Message-ID: <MPG.1bb358ccbc69830a9896ac@forums.sybase.com>
References: <MPG.1bb22542e01236039896a2@forums.sybase.com> <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com> <MPG.1bb24d2ead32cdff9896a7@forums.sybase.com> <MPG.1bb24f41d7fe14039896a8@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
Date: 16 Sep 2004 00:11:32 -0700
X-Trace: forums-1-dub 1095318692 194.7.38.226 (16 Sep 2004 00:11:32 -0700)
X-Original-Trace: 16 Sep 2004 00:11:32 -0700, uu194-7-38-226.unknown.uunet.be
Lines: 53
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:368
Article PK: 424543

FYI, i've opened a case for this #11072451
In article <MPG.1bb24f41d7fe14039896a8@forums.sybase.com>,
bedeNOSP@Msofico.be says...

> just found out this.. (thx Roy)
> "You can't convert a blob to a string -- even with the String( blob )
> function -- as the resulting string will be truncated at the first null
> character in the blob. Instead, you should use the BlobMid() and
> BlobEdit() functions to parse the information stored in the blob."
>
> At least i've got an idea what's going wrong, but it doesn't take me
> much closer to a solution.
>
> Any ideas?
>
>
> In article <MPG.1bb24d2ead32cdff9896a7@forums.sybase.com>,
> bedeNOSP@Msofico.be says...
> > the next plan was this: convert the blob to string and convert the
> > string to int[]
> >
> > however, after putting a file (like a bitmap or something) into the
> > blob, the String(blob) is only a few garbage-like characters..
> >
> > i'm using blobs of hundreds/thousands of bytes length.
> > dunno how it gets to a string of only 10 characters.
> >
> > ls_blob = String(lblb_file)
> > ls_blob = String(BlobMid(lblb_file, 1))
> >
> > // Convert to int[]
> > Long ll_len
> > For ll_len = 1 To Len(ls_blob)
> > li_blob[ll_len] = Asc(mid(ls_blob, ll_len, 1))
> > Next
> >
> >
> > duh.. and it's not even Monday anymore!
> >
> >
> > In article <MPG.1bb2358c4a2cfd79896a5@forums.sybase.com>,
> > bedeNOSP@Msofico.be says...
> > > just tried that technique with the integer array
> > >
> > > result is this error:
> > >
> > > RuntimeError: Array expected in ANY variable at line 98 in clicked event
> > > of object cb_import of u_document.
> > >
> > > maybe through (BlobToString) and then making it into an integer array..
> > >
> > > but this is taking it too far, isn't it?
> > >
> > > am i overlooking something or should blob remain blob?


Bede <bede_nosp Posted on 2005-01-05 09:22:47.0Z
From: Bede <bede_nosp@m_sofico.be>
Newsgroups: sybase.public.powerbuilder.ejbclient
Subject: Re: Blob as Integer[]??
Message-ID: <MPG.1c45d04ec0fac9dd98969d@forums.sybase.com>
References: <MPG.1bb22542e01236039896a2@forums.sybase.com>
Organization: Sofico
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.70.2067
X-Original-NNTP-Posting-Host: uu194-7-38-226.unknown.uunet.be
X-Original-Trace: 5 Jan 2005 01:22:44 -0800, uu194-7-38-226.unknown.uunet.be
Lines: 14
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 5 Jan 2005 01:22:45 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 5 Jan 2005 01:22:47 -0800
X-Trace: forums-1-dub 1104916967 10.22.108.75 (5 Jan 2005 01:22:47 -0800)
X-Original-Trace: 5 Jan 2005 01:22:47 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.ejbclient:430
Article PK: 424605

Just saw this post again and thought i'd quickly add our solution for
this problem:

The java class in which the blob (now int-array) is stored gets 2 extra
methods: writeToFile(String filename) and readFromFile(String filename)
We simply call those 2 java methods on the parameter that contains the
blob and avoid hitting PB limits.
This way the handling of the binary data is completely done in java, and
poses no issues for PB anymore.

However, this doesn't change my opinion that PB should be able to cope
with this in the first place.

Ben