Проверка на NULL
1 2 3 4 5 6 |
with qSomeQuery do begin if FieldByName('someField').IsNull then //do something end; |
Запись NULL значений, согласно инструкции
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// setting param to null ... qSomeQuery.SQL.Text:= 'INSERT INTO DATABASE.TABLE (`someParam`) values (:someParam)'; ... //To set the parameter value to Null, specify the parameter data type, then call the Clear method: with qSomeQuery do begin with ParamByName('someParam') do begin DataType:=ftInteger; Clear(); Bound:=true; end; ExecSQL; end; |
Пример из проекта…
1 2 3 4 5 6 |
SET foreign_key_checks = 0; UPDATE `galionsms_db`.`clients` SET `partners_id`=:partners_id WHERE `id`=:id; SET foreign_key_checks = 1; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
with qUpdatePartners_idInClients do begin Connection:=DBConnection.FDConnection; with ParamByName('partners_id') do begin DataType:=ftInteger; Clear(); Bound:=true; end; Params.ParamValues['id']:=ClientsOfPartner[i]; ExecSQL; end; |