Parameter problems
Posted: Mon 12 Dec 2011 15:12
Table:
Delphi-Code:
Info from DBMonitor:
The problem is that I get a syntax error in the IDE. But in the "DBMonitor" everything looks quite reasonable.
My pattern:
http://www.devart.com/dotconnect/oracle ... l#examples
Thanks for help
Code: Select all
-- ----------------------------
-- Table structure for `testtbl`
-- ----------------------------
DROP TABLE IF EXISTS `testtbl`;
CREATE TABLE `testtbl` (
`ReadAccess` tinyint(1) DEFAULT NULL,
`WriteAccess` tinyint(1) DEFAULT NULL,
`Format` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`Format`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of testtbl
-- ----------------------------
INSERT INTO `TestTbl` VALUES (null, null, '0');
INSERT INTO `TestTbl` VALUES (null, null, '1');
INSERT INTO `TestTbl` VALUES (null, null, '22');
INSERT INTO `TestTbl` VALUES (null, null, '33');
INSERT INTO `TestTbl` VALUES (null, null, '44');
INSERT INTO `TestTbl` VALUES (null, null, '55');
INSERT INTO `TestTbl` VALUES (null, null, '66');
Code: Select all
MyQuery.SQL.Text := 'UPDATE `TestTbl` SET ' +
'(`ReadAccess`,`WriteAccess`) VALUES (:`ReadAccess`,:`WriteAccess`) ' +
'WHERE (`Format` = :`Format`)';
for i := 0 to 255 do
begin
MyQuery.ParamByName('Format').AsInteger := i;
MyQuery.ParamByName('WriteAccess').AsBoolean := (i and (1 shl 7)) 0;
MyQuery.ParamByName('ReadAccess').AsBoolean := (i and (1 shl 6)) 0;
MyQuery.Execute;
end;
Code: Select all
SQL:
UPDATE `TestTbl` SET (`ReadAccess`,`WriteAccess`) VALUES (:`ReadAccess`,:`WriteAccess`) WHERE (`Format` = :`Format`)
Parameters:
Name Type Data Type In Value Out Value
ReadAccess Boolean False
Write Access Boolean False
Format Integer 0
My pattern:
http://www.devart.com/dotconnect/oracle ... l#examples
Thanks for help