Пример #1
0
            schema = openedIter.next()
        except (StopIteration, apsw.ExecutionCompleteError), e:
            try:
                if hasattr(openedIter, 'close'):
                    openedIter.close()
                    openedIter = None
            except:
                pass
            raise functions.DynamicSchemaWithEmptyResultError(envars['modulename'])
        except apsw.AbortError:
            openedIter.close()
            openedIter = iterFunc()
            schema = openedIter.next()

        self.tableObjs[tablename] = (
        schemaUtils.CreateStatement(schema, tablename), LTable(self.tableObjs, envars, TableVT, iterFunc, openedIter))
        if functions.settings['tracing']:
            print 'VT_Schema: %s' % (self.tableObjs[tablename][0])
        return self.tableObjs[tablename]

    @echocall
    def Connect(self, db, modulename, dbname, tablename, *args):
        if tablename not in self.tableObjs:
            return self.Create(db, modulename, dbname, tablename, *args)
        return self.tableObjs[tablename]


class LTable(object):  ####Init means setschema and execstatus
    @echocall
    def __init__(self, tblist, envars, tableObj, iterFunc,
                 openedIter=None):  # tablename, auto , cursorfunc, ommit tuple OPTIONAL []
Пример #2
0
            schema = openedIter.next()
        except (StopIteration, apsw.ExecutionCompleteError), e:
            try:
                if hasattr(openedIter, 'close'):
                    openedIter.close()
                    openedIter = None
            except:
                pass
            raise functions.DynamicSchemaWithEmptyResultError(
                envars['modulename'])
        except apsw.AbortError:
            openedIter.close()
            openedIter = iterFunc()
            schema = openedIter.next()

        self.tableObjs[tablename] = (schemaUtils.CreateStatement(
            schema, tablename),
                                     LTable(self.tableObjs, envars, TableVT,
                                            iterFunc, openedIter))
        if functions.settings['tracing']:
            print 'VT_Schema: %s' % (self.tableObjs[tablename][0])
        return self.tableObjs[tablename]

    @echocall
    def Connect(self, db, modulename, dbname, tablename, *args):
        if tablename not in self.tableObjs:
            return self.Create(db, modulename, dbname, tablename, *args)
        return self.tableObjs[tablename]


class LTable(object):  ####Init means setschema and execstatus
    @echocall
Пример #3
0
 def _setschema(self):
     descr = self.vtable.getdescription(
     )  ### get list of tuples columnname, type
     self.schema = schemaUtils.CreateStatement(descr, self.tablename)