Getting metadata from db

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for Oracle in Delphi and C++Builder
Post Reply
Thomas.Schweikert
Posts: 30
Joined: Tue 27 Jun 2006 15:46

Getting metadata from db

Post by Thomas.Schweikert » Wed 30 Jun 2010 07:58

hi,

i just wanted to use the DBX4 metadata classes.
the following code - working with InterBase / Firebird -
for every table generates an exception
(translated from german error message)

"Can't access TDBXTypes.BLOB value type as TDBXTypes.WideString

Code: Select all

...
var
   dbxColums: TDBXColumnsTableStorage;

begin
   dbxColums := metaProvider.GetCollection(TDBXMetaDataCommands.GetColumns + ' ' +
      sTableName) as TDBXColumnsTableStorage;

      while dbxColums.Next do     <--- exception
      begin
        ...
      end;

using the original driver from codegear there's no exception.


RAD Studio 2009 Enterprise
Oracle 8


Thomas


PS: with new build v4.50.21 error is still there

Thomas.Schweikert
Posts: 30
Joined: Tue 27 Jun 2006 15:46

Post by Thomas.Schweikert » Tue 06 Jul 2010 08:17

Hi,

if i set

UseUnicode=False

then the error occurs.


Thomas

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Tue 06 Jul 2010 11:13

Hello

To resolve this issue I need the DDL script for creating the table metadata of which you what to get.

Thomas.Schweikert
Posts: 30
Joined: Tue 27 Jun 2006 15:46

Post by Thomas.Schweikert » Tue 06 Jul 2010 16:16

hi,

the error occurs with every table i want to read metadatas from.
just create a simple dummy table

CREATE TABLE TEST.METADATA
(
ID NUMBER(10,0),
SOME_DATA VARCHAR2(15),
PRIMARY KEY (
ID
) ENABLE VALIDATE
)

with dbexpress connection settings

[TEST_Oracle]
BlobSize=-1
DataBase=ORA
DriverName=DevartOracle
ErrorResourceFile=
LocaleCode=0000
Password=test
Oracle TransIsolation=ReadCommited
RoleName=Normal
User_Name=TEST
LongStrings=True
EnableBCD=True
InternalName=
UseQuoteChar=False
FetchAll=False
CharLength=0
Charset=
;;UseUnicode=False

with activ error occurs.

Thomas

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 07 Jul 2010 13:00

Thank you for the information. We have reproduced your issue. We will notify you as soon as we have any result.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Tue 17 Aug 2010 13:27

Hello

The DBXOracleMetaDataReader RAD Studio unit has an error. To fix it you can copy this unit from "D:\Program Files\Embarcadero\RAD Studio\7.0\source\database\DBXOracleMetaDataReader.pas" to the folder, where your application is located. And fix the TDBXOracleCustomMetaDataReader.TDBXOracleColumnsCursor.Next function:

From:

Code: Select all

function TDBXOracleCustomMetaDataReader.TDBXOracleColumnsCursor.Next: Boolean;
begin
  if inherited Next then
  begin
    if FDefaultValue = nil then
      FDefaultValue := TDBXWritableValue(TDBXValue.CreateValue(TDBXValueType(inherited GetWritableValue(TDBXColumnsIndex.DefaultValue).ValueType.Clone())));
    FDefaultValue.SetWideString(Trim(inherited GetWritableValue(TDBXColumnsIndex.DefaultValue).AsString));
    Exit(True);
  end;
  if FDefaultValue  nil then
    FDefaultValue.SetNull;
  Result := False;
end;
To:

Code: Select all

function TDBXOracleCustomMetaDataReader.TDBXOracleColumnsCursor.Next: Boolean;
begin
  if inherited Next then
  begin
    if FDefaultValue = nil then
      FDefaultValue := TDBXWritableValue(TDBXValue.CreateValue(TDBXValueType(inherited GetWritableValue(TDBXColumnsIndex.DefaultValue).ValueType.Clone())));
//    FDefaultValue.SetWideString(Trim(inherited GetWritableValue(TDBXColumnsIndex.DefaultValue).AsString));
    FDefaultValue.SetValue(GetWritableValue(TDBXColumnsIndex.DefaultValue));
    Exit(True);
  end;
  if FDefaultValue  nil then
    FDefaultValue.SetNull;
  Result := False;
end;
After these changes dbExpress driver will return correct meta data for UseUnicode=True and for UseUnicode=Fasle.

Unfortunately, we cannot fix the DBXOracleMetaDataReader RAD Studio unit, therefore we are going to develop our own units for getting meta data.

Post Reply