Here's the database that I'm using...
CREATE TABLE `users` (
`userID` bigint(20) unsigned NOT NULL auto_increment,
`username` varchar(32) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`name` varchar(255) NOT NULL default '',
`active` tinyint(1) unsigned NOT NULL default '0',
`accountaccess` tinyint(1) unsigned NOT NULL default '0',
`adminaccess` tinyiny(1) unsigned NOT NULL default '0',
PRIMARY KEY (`userID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=0 AUTO_INCREMENT=1 ;
INSERT INTO `users` VALUES (1, 'admin', '43e9a4ab75570f5b', 'Administrator', 1, 1, 1);
I have that on a remote MySQL database and an embedded localdatabase with just the table (no data in the local database). If I do the following code:
frmLogin.remoteQuery.SQL.Text := 'SELECT * FROM users';
frmLogin.remoteQuery.Open;
for i := 1 to frmLogin.remoteQuery.RecordCount do
begin
frmLogin.localQuery.SQL.Clear;
frmLogin.localQuery.SQL.Text := 'INSERT INTO users (userID, username, password, name, active, accountaccess, adminaccess) VALUES (' + inttostr(frmLogin.remoteQuery.FieldValues['userID']) + ', ' + QuotedStr(frmLogin.remoteQuery.FieldValues['username']) + ', ' + QuotedStr(frmLogin.remoteQuery.FieldValues['password']) + ', ' + QuotedStr(frmLogin.remoteQuery.FieldValues['name']) + ', ' + inttostr(frmLogin.remoteQuery.FieldValues['active']) + ', ' + inttostr(frmLogin.remoteQuery.FieldValues['accountaccess']) + ', ' + inttostr(frmLogin.remoteQuery.FieldValues['adminaccess']) + ')';
frmLogin.localQuery.Execute;
frmLogin.remoteQuery.Next;
end;
The values of active, accountaccess, and adminaccess all become true instead of 0 or 1.
Problem with tinyint
-
WarForge00
- Posts: 3
- Joined: Sat 25 Mar 2006 17:56
-
swierzbicki
- Posts: 451
- Joined: Wed 19 Jan 2005 09:59