Einzelnen Beitrag anzeigen

Delphi.Narium

Registriert seit: 27. Nov 2017
2.415 Beiträge
 
Delphi 7 Professional
 
#23

AW: select mit ' läuft nicht

  Alt 10. Okt 2021, 09:04
MS SQL kann damit problemlos umgehen. Das trifft aber nicht auf alle Datenbanksysteme zu.

Wenn man mit Delphi Datenbankprogramme schreibt, ohne sich auf die dahinterliegende Datenbank festzulegen, sollte man halt immer im Auge behalten, dass QuotedStr funktionieren kann, aber nicht muss.

Zitat von Access:
In Access, you use the double-quote character around literal text, such as the Control Source of a text box: ="This text is in quotes." Often, you need quote marks inside quotes, e.g. when working with DLookup (). This article explains how.
Zitat von MySQL:
MySQL QUOTE () produces a string which is a properly escaped data value in an SQL statement, out of a user supplied by the string as an argument. The function achieves this by enclosing the string with single quotes, and by preceding each single quote, backslash, ASCII NUL and control-Z with a backslash.
Zitat von PostGres:
Basically, a single quote is used to define a token as a string; this is the context used in PostgreSQL for different purposes. When we write any text in a single quote it is treated as a reference object and the identifier is represented by using double-quoted text. For example, suppose our statement is like select ‘Welcome in PostgreSQL’;
Zitat von SQLite:
The SQLite quote () function allows you to escape a string so that it’s suitable for inclusion in an SQL statement. Strings are surrounded by single-quotes with escapes on interior quotes. BLOBs are encoded as hexadecimal literals. Note that strings with embedded NUL characters cannot be represented as string literals in SQL.
Zitat von Ingres:
Use single quotes to delimit embedded SQL string literals. To embed a single quote in a string literal, you must double it. Example: Quote usage in string literals. exec sql insert into comments (anecdotes) values ('single'' quote followed by double " quote'); This insert example writes the following string into the anecdotes column of the comments table: single' quote followed by double ...
Zitat von Oracle:
Oracle Database offers the ability, in both SQL and PL/SQL, to specify our own user-defined delimiters for string literals. Here's how it works: you prefix your literal with the letter "q". Then you type a single quote, followeed by your starting delimiter for the literal. Then you type your literal string without having to double up on your single quote characters. When you have ...
Sie machen es alle ähnlich und doch alle ein bisserl anders, soviel zum Thema "Standardisierung"

Das Schöne an Parametern ist, dass man sich im Delphi-Quelltext nicht um diese Feinheiten kümmern muss. Da nimmt einem das die Datenbankschnittstelle ab.

Geändert von Delphi.Narium (10. Okt 2021 um 09:52 Uhr) Grund: Schreibfehler ...
  Mit Zitat antworten Zitat