X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=scripts%2Fstatev_sql.py;h=f13931c7600270f2496c6acd5330eb8eae9ba13d;hb=6ae0cb63318e329477270654d1bf4962ecbbd64d;hp=0d50b37fa21caeb97055e55bb699a47dcc921809;hpb=f79fee98d4a78873bf67a2d4eb4ae615aaecaa4a;p=libfirm diff --git a/scripts/statev_sql.py b/scripts/statev_sql.py index 0d50b37fa..f13931c76 100755 --- a/scripts/statev_sql.py +++ b/scripts/statev_sql.py @@ -76,8 +76,8 @@ class EmitMysql(EmitBase): self.execute('drop table if exists `%s`' % self.evtab) self.execute('drop table if exists `%s`' % self.ctxtab) - self.create_table(ctxcols, self.ctxtab, "text", "int auto_increment", extra = ", PRIMARY KEY (`id`)") - self.create_table(evcols, self.evtab, "data", "int not null", extra = ", INDEX(`id`)") + self.create_table(ctxcols, self.ctxtab, "text", "int auto_increment", extra = ", PRIMARY KEY (`id`)") + self.create_table(evcols, self.evtab, "data", "int not null", extra = ", INDEX(`id`)") keys = "id, " + ", ".join(evcols) marks = ",".join(['%s'] * (len(evcols)+1)) @@ -125,13 +125,10 @@ class EmitSqlite3(EmitBase): self.ctxtab = options.prefix + "ctx" self.evtab = options.prefix + "ev" - if not options.update: - self.create_table(ctxcols, self.ctxtab, "text", "integer primary key") - #self.execute("CREATE INDEX IF NOT EXISTS `%sindex` ON `%s`(id)" - # % (self.ctxtab, self.ctxtab)) - self.create_table(evcols, self.evtab, "data", "int") - self.execute("CREATE INDEX IF NOT EXISTS `%sindex` ON `%s`(id)" - % (self.evtab, self.evtab)) + self.create_table(ctxcols, self.ctxtab, "text", "integer primary key") + self.create_table(evcols, self.evtab, "data", "int") + self.execute("CREATE INDEX IF NOT EXISTS `%sindex` ON `%s`(id)" + % (self.evtab, self.evtab)) keys = "id, " + ", ".join(evcols) marks = ",".join(["?"] * (len(evcols)+1)) @@ -306,14 +303,15 @@ class Conv: self.evvals[keyidx] = value def __init__(self): - parser = optparse.OptionParser('usage: %prog [options] ') - parser.add_option("", "--update", dest="update", help="update database instead of dropping all existing values", action="store_true", default=False) + parser = optparse.OptionParser('usage: %prog [options] ', add_help_option=False) + parser.add_option("", "--help", help="show this help message and exit", action="help") + parser.add_option("", "--update", dest="update", help="update database instead of dropping all existing values", action="store_true", default=False) parser.add_option("-v", "--verbose", dest="verbose", help="verbose messages", action="store_true", default=False) parser.add_option("-f", "--filter", dest="filter", help="regexp to filter event keys", metavar="REGEXP") parser.add_option("-u", "--user", dest="user", help="user", metavar="USER") - parser.add_option("-H", "--host", dest="host", help="host", metavar="HOST") + parser.add_option("-h", "--host", dest="host", help="host", metavar="HOST") parser.add_option("-p", "--password", dest="password", help="password", metavar="PASSWORD") - parser.add_option("-d", "--db", dest="database", help="database", metavar="DB") + parser.add_option("-D", "--database", dest="database", help="database", metavar="DB") parser.add_option("-e", "--engine", dest="engine", help="engine (sqlite3, mysql)", metavar="ENG", default='sqlite3') parser.add_option("-P", "--prefix", dest="prefix", help="table prefix", metavar="PREFIX", default='') (options, args) = parser.parse_args()