Fix issue #1033: wrong bit field default syntax

This commit is contained in:
Ansgar Becker
2009-03-16 23:02:49 +00:00
parent 47662cac51
commit 2c75d385d3
2 changed files with 11 additions and 3 deletions

View File

@ -202,8 +202,12 @@ begin
createQuery := createQuery + ' UNSIGNED'; // Unsigned
if FieldType.HasZerofill and cols[i].Zerofill then
createQuery := createQuery + ' ZEROFILL'; // Zerofill
if cols[i].Default <> '' then
createQuery := createQuery + ' DEFAULT ''' + cols[i].Default + ''''; // Default
if cols[i].Default <> '' then begin
createQuery := createQuery + ' DEFAULT ';
if cols[i].FieldType = tpBIT then
createQuery := createQuery + ' b';
createQuery := createQuery + '''' + cols[i].Default + ''''; // Default
end;
if cols[i].NotNull then
createQuery := createQuery + ' NOT NULL'; // Not null
if cols[i].AutoIncrement then

View File

@ -535,7 +535,11 @@ begin
case comboDefault.ItemIndex of
DEFAULT_NULL: strDefault := 'NULL';
DEFAULT_CURTS: strDefault := 'CURRENT_TIMESTAMP';
DEFAULT_CUSTOM: strDefault := esc(editDefault.Text);
DEFAULT_CUSTOM: begin
strDefault := esc(editDefault.Text);
if IndexToType(ComboBoxType.ItemIndex) = tpBIT then
strDefault := 'b' + strDefault;
end;
end;
if strDefault <> '' then
strDefault := ' DEFAULT '+strDefault;