Delphi-Version: 10 Seattle
''case erwartet Konstantenausdruck
Moin!
Ich steh grad etwas auf dem Schlauch. Der Compiler mäkelt einen fehlenden Konstantenausdruck an, der aber eine Konstante ist:
Delphi-Quellcode:
unit server_capabilities;
interface type TServerBranch = (sbOther, sbMariaDB, sbMySQL); TServerFeature = Integer; TServerMutableString = Integer; TServerVersion = Integer; const SRVFT_USER_ROLES: TServerFeature = $100001; SRVMS_PASSWORD_COLUMN: TServerMutableString = $200001; type TServerCapabilities = class private FServerBranch: TServerBranch; FServerVersion: TServerVersion; public constructor Create(Branch: TServerBranch; Version: TServerVersion); virtual; function HasFeature(const AFeature: TServerFeature): Boolean; virtual; function MutableString(const AMutableString: TServerMutableString): string; virtual; end; implementation { TServerCapabilities } constructor TServerCapabilities.Create(Branch: TServerBranch; Version: TServerVersion); begin FServerBranch:= Branch; FServerVersion:= Version; end; function TServerCapabilities.HasFeature( const AFeature: TServerFeature): Boolean; begin Result:= FALSE; case FServerBranch of sbMariaDB: begin case AFeature of SRVFT_USER_ROLES: // <-- [dcc32 Fehler] server_capabilities.pas(45): E2026 Konstantenausdruck erwartet Result:= (FServerVersion >= 100005); end; end; sbMySQL: begin case AFeature of SRVFT_USER_ROLES: // <-- [dcc32 Fehler] server_capabilities.pas(45): E2026 Konstantenausdruck erwartet Result:= (FServerVersion >= 80000); end; end; end; end; function TServerCapabilities.MutableString( const AMutableString: TServerMutableString): string; begin Result:= ''; case FServerBranch of sbMariaDB: begin case AMutableString of SRVMS_PASSWORD_COLUMN: // <-- [dcc32 Fehler] server_capabilities.pas(45): E2026 Konstantenausdruck erwartet Result:= 'Password'; end; end; sbMySQL: begin case AMutableString of SRVMS_PASSWORD_COLUMN: // <-- [dcc32 Fehler] server_capabilities.pas(45): E2026 Konstantenausdruck erwartet begin if FServerVersion >= 50706 then Result:= 'authentication_string' else Result:= 'password'; end; end; end; end; end; end. |
AW: ''case erwartet Konstantenausdruck
Nach einem kurzen Blick sehe ich typisierte Konstanten und mit denen geht das nicht !
|
AW: ''case erwartet Konstantenausdruck
Zitat:
Danke, Problem gelöst! :thumb: |
AW: ''case erwartet Konstantenausdruck
Jupp, typisierte Konstanten sind eigentlich "nur" schreibgeschützte Variablen, aber Nichttypisierte ...
Delphi-Quellcode:
const
SRVFT_USER_ROLES = TServerFeature($100001); SRVMS_PASSWORD_COLUMN = TServerMutableString($200001); 18 Uhr in China, aber die haben eh gade alle gleichzeitig ihren einwöchigen Jahresurlaub zum Jahresanfang, also passt doch ... niemand denkt, vorallem da sie den Anfang schonwieder um 2 Monate verpasst haben. :stupid: |
AW: ''case erwartet Konstantenausdruck
Zitat:
Zitat:
|
AW: ''case erwartet Konstantenausdruck
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz