Autor Beitrag
JVS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 20.08.09 10:23 
Hallo alle zusammen,

um in einem Integer einzelne Bits zu setzen/löschen, nutze ich
normalerweise folgendes:

Wert := Wert OR Maske (zum Setzen)
Wert := Wert AND NOT Maske (zum Löschen)

Kann ich das in einem SQL-Statement unterbringen,
um in einem Rutsch eine komplette Tabelle zu aktualisieren?
Bisher muß ich jeden Datsatz einzeln per Tippeltappel (WHILE NOT tab.eof ...) anfassen.

AND, OR und NOT haben ja in SQL eine andere Wirkung.
Gibt es so was wie Bitmaskenbefehle im Standard-SQL?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 20.08.09 10:29 
Ja
ausblenden SQL-Anweisung
1:
update <Tabelle> set <Feld> = :wert where <Bedingung>;					

_________________
Markus Kinzler.
JVS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 20.08.09 10:42 
Hi mkizler,

also ich möchte, dass etwas in der Art

ausblenden SQL-Anweisung
1:
  Update <Tabelle> Set <Feld> = <Feld> OR Bitmaske					


funktioniert wie innerhalb von Delphi:
das OR nicht als "SQL-OR" sondern als Bitoperation.
Das seh ich bei deinem Vorschlag jetzt noch nicht, oder?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 20.08.09 10:44 
Moin!

user profile iconJVS hat folgendes geschrieben Zum zitierten Posting springen:
AND, OR und NOT haben ja in SQL eine andere Wirkung.
Gibt es so was wie Bitmaskenbefehle im Standard-SQL?
Also zumindest MySQL kennt natürlich auch Binäroperatoren. Ob dir das was nutzt, hängt davon ab, welches DBMS du nutzt. :nixweiss: Würde mich aber wundern, wenn ein aktuelles DBMS sowas nicht könnte... :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Do 20.08.09 10:52 
Firebird kennt ab 2.1 z.B. BIN_OR

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)
JVS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Do 20.08.09 10:52 
Habe über ADO / Jet 4.0 OLEDB eine Accessdatenbank am Wickel.
Gibt es da was in der Richtung?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 20.08.09 11:53 
Moin!

AFAIK werden die SQL-Statemants direkt an Access weitergereicht, da passiert im ODBC-Treiber weiter nix. Deshalb: schonmal in der Access-Hilfe geschaut, ob/wie man das macht, dann das entsprechende SQL-Statement generieren lassen. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.