[Gambas-user] SHELL command with python does not execute!

Fabien Bodard gambas.fr at ...626...
Thu Feb 11 14:41:17 CET 2010


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 ?


2010/2/11 Vassilis K <vkan53 at ...2300...>:
> I am using python because it executes the table creation commands with
> the same type like in terminal mode. For example in python we write:
>
> 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
>         """
>
> cursor.execute(sql)
>
> Because of this I assume that there is less possibility of errors.
>
> Do you suggest to use the Gambas code for table and database creation?
>
>
>
> ------------------------------------------------------------------------------
> 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list