Got "Operation Not Supported" message when run to RecordCount.

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
Eden0928
Posts: 62
Joined: Sun 22 Apr 2012 14:08

Got "Operation Not Supported" message when run to RecordCount.

Post by Eden0928 » Thu 24 Feb 2022 02:42

I have a SQL:

Code: Select all

SELECT COLUMN_NAME AS name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + CONSTRAINT_NAME), 'IsPrimaryKey') = 1 AND TABLE_NAME = 'TBNAME' AND TABLE_SCHEMA = 'dbo'
AND Delphi Code:

Code: Select all

function v_FetchQueryPrimaryKey(A_Query: TSQLQuery; A_TableName: string): string;
var
  LColumnDS: TSQLQuery;
  LColumnField: TField;
begin
  Result := '';
  if A_TableName = '' then Exit;

  LColumnDS:= TSQLQuery.Create(A_Query);
  LColumnDS.SQLConnection := A_Query.SQLConnection;
  try
    LColumnDS.SQL.Text :=
      Format('SELECT COLUMN_NAME AS name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + ''.'' + CONSTRAINT_NAME), ''IsPrimaryKey'') = 1 '
            +'AND TABLE_NAME = ''%s'' AND TABLE_SCHEMA = ''dbo'' ', [A_TableName]);
    LColumnDS.Open;
    LColumnField := LColumnDS.Fields[0];
    while not LColumnDS.Eof do
    begin
      if A_Query.FindField(LColumnField.AsString) <> nil then begin
        Result := Result + UpperCase(LColumnField.AsString);

        if LColumnDS.RecNo <> LColumnDS.Recordcount then  // <- NOTE LColumnDS.Recordcount!
          Result := Result + ',';
      end;

      LColumnDS.Next();
    end;
  Finally
    FreeAndNil(LColumnDS);
  end;
end;
TSQLQuqery.RecordCount will run to TCustomSQLDataSet.GetRecordCount ,however "Query := Query + GetQuoteChar + TableName + GetQuoteChar", the "GetQuoteChar" under ISAPI you will get the ["] values (Under EXE I get empty string, which is the correct result).

I got the error message:"Operation Not Supported" in ISAPI mode.

Keep following the "GetQuoteChar" source code, it seems to come from the MetaData driver, the Devart DBX Driver.

Any ideas on whether this is a bug or not and if so where?

My environment:
  • Windows 10 and Windows Server 2012 IIS
  • SQL Server 2014
  • Delphi XE7
  • dbexpress for SQL Server 9.0.1 and used DevartSQLServerDirectBuiltin mode.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Got "Operation Not Supported" message when run to RecordCount.

Post by Stellar » Thu 10 Mar 2022 08:19

Hi,

Thanks for your request.

Unfortunately, we couldn't reproduce the issue. To investigate this behavior of Devart dbExpress Driver for SQL Server, please compose a full sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

Best regards,
Sergey

Post Reply