예제 #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
파일: xml2html.py 프로젝트: 7o9/stdm-plugin
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
예제 #6
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
예제 #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()