bf4729349a3b0c56f2e610178a0c834791dfce2f max Fri Jan 24 08:55:49 2014 -0800 tiny update for sqlToAs diff --git src/oneShot/sqlToAs/sqlToAs src/oneShot/sqlToAs/sqlToAs index e2c317c..ce86246 100755 --- src/oneShot/sqlToAs/sqlToAs +++ src/oneShot/sqlToAs/sqlToAs @@ -59,31 +59,32 @@ tableLine = "table %s" % name continue elif lowLine.startswith("key") or lowLine.startswith("primary") or lowLine.startswith("fulltext") \ or "character set" in lowLine: continue # `chrom` varchar(255) NOT NULL, # chromosome # `start` int unsigned NOT NULL, # start else: parts = line.split() fieldName, sqlType = parts[:2] # special case for integers if len(parts)>2 and "signed" in parts[2]: sqlType=sqlType+" "+parts[2] - fieldName = fieldName.strip("`") + fieldName = fieldName.strip("`").strip(",") + sqlType = sqlType.strip(",") if sqlType.startswith("char"): asType = sqlType.replace("(","[").replace(")","]") else: sqlType = sqlType.split("(")[0] asType = sqlToAs[sqlType] if "#" in line: comment = line.split("#")[1].strip() else: comment = "" spaces = "".join((20-len(fieldName)-len(asType))*[" "]) asLine = '%s %s;%s"%s"' % (asType, fieldName, spaces, comment) fieldLines.append(asLine)