DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Just starting out? Need help? Post your questions and find answers here.
wayne-c
Enthusiast
Enthusiast
Posts: 335
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Post by wayne-c »

In an environment with an Oracle database, connected via ODBC (64bit), I have the following code to automatically return a blob image as a Base64 string:

Code: Select all

If DatabaseColumnType(hDatabase, k) = #PB_Database_Blob
	BufferLength = DatabaseColumnSize(hDatabase, k)

	; BUFFERLENGTH IS ALWAYS = 2147483647 !!!

	If BufferLength > 0
		*Buffer = AllocateMemory(BufferLength)
		If *Buffer <> 0
			If GetDatabaseBlob(hDatabase, k, *Buffer, BufferLength)
				Field$ = Base64Encoder(*Buffer, BufferLength)
			EndIf
			FreeMemory(*Buffer)
		EndIf
	EndIf
Else
	Field$ = GetDatabaseString(hDatabase, k)
EndIf
DatabaseColumnSize() always returns the value of 2147483647, which is obviously not the actual blob size :-(
Maybe a bug in the DatabaseColumnSize() function?
As you walk on by, Will you call my name? Or will you walk away?
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Post by the.weavster »

BLOBs are often stored in the table as a pointer and the actual data is elsewhere. 2147483647 is the largest value a 32-bit integer can represent so I should think this is something to do with the field in the table being a pointer.
wayne-c
Enthusiast
Enthusiast
Posts: 335
Joined: Tue Jun 08, 2004 10:29 am
Location: Zurich, Switzerland

Re: DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Post by wayne-c »

@the.weavster: but there is the function GetDatabaseBlob() and this function should handle all this (pointer or direct data), not?

Ok next question: has anybody succeeded in loading a Blob from Oracle via ODBC ??? How ???
As you walk on by, Will you call my name? Or will you walk away?
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Re: DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Post by kpeters58 »

Just wondering: Does DatabaseColumnType return #PB_Database_Blob?
PB 5.73 on Windows 10 & OS X High Sierra
User avatar
idle
Always Here
Always Here
Posts: 5098
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: DatabaseColumnSize wrong? (PB 5.72 x64 Win)

Post by idle »

if It's returning -1, it's likely reporting an error but I can't see anything in the docs that would suggest that, what does DatabaseError() say?
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply