> Fabien Bodard ha scritto: > > Le 11 février 2010 15:23, Benoît Minisini > > > > <gam...@users.sourceforge.net> a écrit : > >>> sql = "CREATE TABLE Aplianikis (" > >>> "aa BIGINT(20) NOT NULL auto_increment," > >>> "Eponimia VARCHAR(40) NOT NULL," > >>> "AFM VARCHAR(18) NOT NULL," > >>> "Hmerominia DATE NOT NULL," > >>> "Checkbox TINYINT(1) NOT NULL," > >>> "primary key(aa)" > >>> ")" > >>> "DEFAULT CHARSET=utf8" > >>> > >>> DB.Exec(sql) > >>> > >>> gambas version : > >>> > >>> Dim htable As Table > >>> htable = db.Tables.Add("Aplianikis") > >>> > >>> htable.Fields.Add("aa", db.Serial, 10) > >>> htable.Fields.Add("Eponimia", db.String, 40) > >>> htable.Fields.Add("AFM", db.String, 18) > >>> htable.Fields.Add("Hmerominia", db.Date) > >>> htable.Fields.Add("Checkbox", gb.Boolean,, False) > >>> htable.PrimaryKey.Add("aa") > >>> > >>> htable.Update > >>> > >>> Query to Benoit ... is there a way to define 'NOT NULL' entry via > >>> gambas code ? > >> > >> You have to define the default value. What's the point of having a > >> mandatory field (NOT NULL) without a default value? > > > > just say i want something ... but i can't say what because there is > > not default rules. > > and then advise the user that he need to say someting by himself > > > > for example my age can't be 0 > > A default value does not imply that a value is required, and a "not > null" clause does not imply a default value. > It seems, indeed, very reasonable: all the four cases have a useful > meaning, and any simplification, I think, would be limiting. Another > example, after the one from Fabien, is the Name field of a private > person. I am sure I want the name of the person, but which name would be > a suitable default? John Smith? And a default value with no "not null" > clause makes sense too in many cases. > > Just a thought... regards, > Doriano >
Mmm. You may be right. :-) But that needs some change in the gb.db component and in all database drivers. -- Benoît Minisini ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user