示例#1
0
 def diffFiles(self, strOldFilename, strNewFilename):
     self.old_xml = xml2ddl.readMergeDict(strOldFilename) # parse an XML file by name
     self.new_xml = xml2ddl.readMergeDict(strNewFilename)
     
     self.diffTables(self.old_xml, self.new_xml)
     
     self.old_xml.unlink()
     self.new_xml.unlink()
     
     return self.diffs
示例#2
0
    def diffFiles(self, strOldFilename, strNewFilename):
        self.old_xml = xml2ddl.readMergeDict(
            strOldFilename)  # parse an XML file by name
        self.new_xml = xml2ddl.readMergeDict(strNewFilename)

        self.diffTables(self.old_xml, self.new_xml)

        self.old_xml.unlink()
        self.new_xml.unlink()

        return self.diffs
示例#3
0
def parseCommandLine():
    import optparse
    
    usage = "usage: %prog [options] <filename>"
    parser = optparse.OptionParser(usage)
    parser.add_option("-f", "--file", dest="filename",
                  help="write report to FILE", metavar="FILE")

    (options, args) = parser.parse_args()

    x2h = Xml2Html()
    
    if len(args) != 1:
        parser.error("incorrect number of arguments")

    strFilename = args[0]
    xml = xml2ddl.readMergeDict(strFilename)
    lines = x2h.outputHtml(xml)
    if options.filename:
        strOutfile = options.filename
    else:
        strOutfile = "outschema.html"
        
    of = open(strOutfile, "w")
    for line in lines:
        of.write("%s\n" % (line))
        
    of.close()
示例#4
0
def parseCommandLine():
    import optparse

    usage = "usage: %prog [options] <filename>"
    parser = optparse.OptionParser(usage)
    parser.add_option("-f",
                      "--file",
                      dest="filename",
                      help="write report to FILE",
                      metavar="FILE")

    (options, args) = parser.parse_args()

    x2h = Xml2Html()

    if len(args) != 1:
        parser.error("incorrect number of arguments")

    strFilename = args[0]
    xml = xml2ddl.readMergeDict(strFilename)
    lines = x2h.outputHtml(xml)
    if options.filename:
        strOutfile = options.filename
    else:
        strOutfile = "outschema.html"

    of = open(strOutfile, "w")
    for line in lines:
        of.write("%s\n" % (line))

    of.close()
示例#5
0
def doCreate(strDbms, strFilename):
    print '\tpython xml2ddl.py --dbms %s %s' % (strDbms, strFilename)
    print

    cd = xml2ddl.Xml2Ddl()
    cd.setDbms(strDbms)
    xml = xml2ddl.readMergeDict(strFilename)
    results = cd.createTables(xml)
    for result in results:
        print "\t%s;" % (result[1].replace('\t', '\t\t'))

    print
def doCreate(strDbms, strFilename):
    print '\tpython xml2ddl.py --dbms %s %s' % (strDbms, strFilename)
    print
    
    cd = xml2ddl.Xml2Ddl()
    cd.setDbms(strDbms)
    xml = xml2ddl.readMergeDict(strFilename)
    results = cd.createTables(xml)
    for result in results:
        print "\t%s;" % (result[1].replace('\t', '\t\t'))

    print
示例#7
0
def writeXml(source, dest, dropTable=True):
    cd = Xml2Ddl()
    cd.setDbms("postgres")
    cd.params["drop-tables"] = dropTable
    cd.params["add_key_constraint"] = dropTable

    # strFilename = path
    xml = readMergeDict(source)
    results = cd.createTables(xml)
    fileN = open(dest, "w")
    for result in results:
        # print result
        fileN.write(result[1])
        fileN.write("\n")

    fileN.close()
示例#8
0
文件: filesave.py 项目: wondie/stdm
def writeXml(source, dest, dropTable=True):
    cd = Xml2Ddl()
    cd.setDbms("postgres")
    cd.params['drop-tables'] = dropTable
    cd.params['add_key_constraint'] = dropTable

    #strFilename = path
    xml = readMergeDict(source)
    results = cd.createTables(xml)
    fileN = open(dest, "w")
    for result in results:
        #print result
        fileN.write(result[1])
        fileN.write("\n")

    fileN.close()
示例#9
0
        return self.lines


if __name__ == "__main__":
    import optparse
    parser = optparse.OptionParser()
    parser.add_option("-f",
                      "--file",
                      dest="filename",
                      help="write report to FILE",
                      metavar="FILE")

    (options, args) = parser.parse_args()

    x2h = Xml2Html()

    strFilename = args[0]
    xml = xml2ddl.readMergeDict(strFilename)
    lines = x2h.outputHtml(xml)
    if options.filename:
        strOutfile = options.filename
    else:
        strOutfile = "outschema.html"

    of = open(strOutfile, "w")
    for line in lines:
        of.write("%s\n" % (line))

    of.close()
示例#10
0
        self.tableToc()
        self.outTables()
        self.addTrailer()

        return self.lines


if __name__ == "__main__":
    import optparse

    parser = optparse.OptionParser()
    parser.add_option("-f", "--file", dest="filename", help="write report to FILE", metavar="FILE")

    (options, args) = parser.parse_args()

    x2h = Xml2Html()

    strFilename = args[0]
    xml = xml2ddl.readMergeDict(strFilename)
    lines = x2h.outputHtml(xml)
    if options.filename:
        strOutfile = options.filename
    else:
        strOutfile = "outschema.html"

    of = open(strOutfile, "w")
    for line in lines:
        of.write("%s\n" % (line))

    of.close()