Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
msilib.Table Class Reference

List of all members.

Public Member Functions

def __init__
def add_field
def sql
def create
def __init__
def add_field
def sql
def create

Public Attributes

 name
 fields

Detailed Description

Definition at line 27 of file __init__.py.


Constructor & Destructor Documentation

def msilib.Table.__init__ (   self,
  name 
)

Definition at line 28 of file __init__.py.

00028 
00029     def __init__(self, name):
00030         self.name = name
00031         self.fields = []

Here is the caller graph for this function:

def msilib.Table.__init__ (   self,
  name 
)

Definition at line 82 of file msilib.py.

00082 
00083     def __init__(self, name):
00084         self.name = name
00085         self.fields = []

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def msilib.Table.add_field (   self,
  index,
  name,
  type 
)

Definition at line 32 of file __init__.py.

00032 
00033     def add_field(self, index, name, type):
00034         self.fields.append((index,name,type))

Here is the caller graph for this function:

def msilib.Table.add_field (   self,
  index,
  name,
  type 
)

Definition at line 86 of file msilib.py.

00086 
00087     def add_field(self, index, name, type):
00088         self.fields.append((index,name,type))

Here is the call graph for this function:

def msilib.Table.create (   self,
  db 
)

Definition at line 77 of file __init__.py.

00077 
00078     def create(self, db):
00079         v = db.OpenView(self.sql())
00080         v.Execute(None)
00081         v.Close()

Here is the call graph for this function:

Here is the caller graph for this function:

def msilib.Table.create (   self,
  db 
)

Definition at line 131 of file msilib.py.

00131 
00132     def create(self, db):
00133         v = db.OpenView(self.sql())
00134         v.Execute(None)
00135         v.Close()

Here is the call graph for this function:

def msilib.Table.sql (   self)

Definition at line 35 of file __init__.py.

00035 
00036     def sql(self):
00037         fields = []
00038         keys = []
00039         self.fields.sort()
00040         fields = [None]*len(self.fields)
00041         for index, name, type in self.fields:
00042             index -= 1
00043             unk = type & ~knownbits
00044             if unk:
00045                 print("%s.%s unknown bits %x" % (self.name, name, unk))
00046             size = type & datasizemask
00047             dtype = type & typemask
00048             if dtype == type_string:
00049                 if size:
00050                     tname="CHAR(%d)" % size
00051                 else:
00052                     tname="CHAR"
00053             elif dtype == type_short:
00054                 assert size==2
00055                 tname = "SHORT"
00056             elif dtype == type_long:
00057                 assert size==4
00058                 tname="LONG"
00059             elif dtype == type_binary:
00060                 assert size==0
00061                 tname="OBJECT"
00062             else:
00063                 tname="unknown"
00064                 print("%s.%sunknown integer type %d" % (self.name, name, size))
00065             if type & type_nullable:
00066                 flags = ""
00067             else:
00068                 flags = " NOT NULL"
00069             if type & type_localizable:
00070                 flags += " LOCALIZABLE"
00071             fields[index] = "`%s` %s%s" % (name, tname, flags)
00072             if type & type_key:
00073                 keys.append("`%s`" % name)
00074         fields = ", ".join(fields)
00075         keys = ", ".join(keys)
00076         return "CREATE TABLE %s (%s PRIMARY KEY %s)" % (self.name, fields, keys)

Here is the caller graph for this function:

def msilib.Table.sql (   self)

Definition at line 89 of file msilib.py.

00089 
00090     def sql(self):
00091         fields = []
00092         keys = []
00093         self.fields.sort()
00094         fields = [None]*len(self.fields)
00095         for index, name, type in self.fields:
00096             index -= 1
00097             unk = type & ~knownbits
00098             if unk:
00099                 print "%s.%s unknown bits %x" % (self.name, name, unk)
00100             size = type & datasizemask
00101             dtype = type & typemask
00102             if dtype == type_string:
00103                 if size:
00104                     tname="CHAR(%d)" % size
00105                 else:
00106                     tname="CHAR"
00107             elif dtype == type_short:
00108                 assert size==2
00109                 tname = "SHORT"
00110             elif dtype == type_long:
00111                 assert size==4
00112                 tname="LONG"
00113             elif dtype == type_binary:
00114                 assert size==0
00115                 tname="OBJECT"
00116             else:
00117                 tname="unknown"
00118                 print "%s.%sunknown integer type %d" % (self.name, name, size)
00119             if type & type_nullable:
00120                 flags = ""
00121             else:
00122                 flags = " NOT NULL"
00123             if type & type_localizable:
00124                 flags += " LOCALIZABLE"
00125             fields[index] = "`%s` %s%s" % (name, tname, flags)
00126             if type & type_key:
00127                 keys.append("`%s`" % name)
00128         fields = ", ".join(fields)
00129         keys = ", ".join(keys)
00130         return "CREATE TABLE %s (%s PRIMARY KEY %s)" % (self.name, fields, keys)

Here is the call graph for this function:


Member Data Documentation

Definition at line 30 of file __init__.py.

Definition at line 29 of file __init__.py.


The documentation for this class was generated from the following files: