From 9d13267e417f7083f42e26ca9b6facfdf4f2b278 Mon Sep 17 00:00:00 2001 From: "rosenfield.albert" Date: Tue, 24 Jun 2008 11:24:36 +0000 Subject: [PATCH] Bugfix: Make it possible to tell "no default value" apart from "default value is NULL" in the table view. --- source/childwin.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/childwin.pas b/source/childwin.pas index 28fbcbe0..6692bda5 100644 --- a/source/childwin.pas +++ b/source/childwin.pas @@ -2019,7 +2019,22 @@ begin if lowercase( ds.FieldByName('Null').AsString ) = 'yes' then VTRowDataListColumns[i-1].Captions.Add('Yes') else VTRowDataListColumns[i-1].Captions.Add('No'); - VTRowDataListColumns[i-1].Captions.Add( ds.FieldByName('Default').AsString ); + + if ds.FieldByName('Default').IsNull then + // In MySQL, it is not possible to use fx NOW() as a column default. + // Also, if default is NULL, then the actual default is either NULL + // or nothing at all. Looking at another column, "Null", can help + // determine which one it really is, as can a SHOW CREATE TABLE. + // According with the above, it is not possible in MySQL to create + // a column which may be NULL but which has no default value. + if LowerCase(ds.FieldByName('Null').AsString) = 'yes' then + VTRowDataListColumns[i-1].Captions.Add('NULL') + else + // No default value. + VTRowDataListColumns[i-1].Captions.Add('') + else + VTRowDataListColumns[i-1].Captions.Add('''' + ds.FieldByName('Default').AsString + ''''); + VTRowDataListColumns[i-1].Captions.Add( ds.FieldByName('Extra').AsString ); if hasCommentColumn then VTRowDataListColumns[i-1].Captions.Add( ds.FieldByName('Comment').AsString )