def setComplexTypes(schema):
    global complexTypes
    complexTypes = schema.getElementData("complexType")
    for ctype in complexTypes:
        complexTypes[ctype][
            "elementsoftype"] = schema.getTypeElementsWithinBase(
                ctype, "element")
        complexTypes[ctype]["elementnames"] = getElementNameList(
            complexTypes[ctype]["elements"])
def setComplexTypes(schema):
	global complexTypes
	complexTypes = schema.getElementData("complexType")
	for ctype in complexTypes:
		complexTypes[ctype]["elementsoftype"] = schema.getTypeElementsWithinBase(ctype, "element")
		complexTypes[ctype]["elementnames"] = getElementNameList(complexTypes[ctype]["elements"])
Ejemplo n.º 3
0
    return parser.parse_args()


database_type = "postgres"
database_name = "vip"
host = "localhost"
username = "******"
password = "******"

parameters = get_parsed_args()

fschema = urllib.urlopen(
    "http://election-info-standard.googlecode.com/files/vip_spec_v3.0.xsd")
schema = schema.Schema(fschema)

complex_types = schema.getElementData("complexType")
simple_types = schema.getElementData("simpleType")

data = schema.getElementData("element")["vip_object"]

#based on the database_type, create the correct connection type, use the same cursor for all stuff since all types use the same object

create_statement = ""

TYPES = {
    "sqlite3": {
        "id": "TEXT",
        "xs:string": "TEXT",
        "xs:integer": "INTEGER",
        "xs:dateTime": "TEXT",
        "xs:date": "TEXT"
Ejemplo n.º 4
0
			help='host address for the database, with sqlite3 assumes a local db and this is the database file location')

	return parser.parse_args()

database_type = "postgres"
database_name = "vip"
host = "localhost"
username = "******"
password = "******"

parameters = get_parsed_args()

fschema = urllib.urlopen("http://election-info-standard.googlecode.com/files/vip_spec_v3.0.xsd")
schema = schema.Schema(fschema)

complex_types = schema.getElementData("complexType")
simple_types = schema.getElementData("simpleType")

data = schema.getElementData("element")["vip_object"]

#based on the database_type, create the correct connection type, use the same cursor for all stuff since all types use the same object

create_statement = ""

TYPES = {"sqlite3":{"id":"TEXT", "xs:string":"TEXT", "xs:integer":"INTEGER", "xs:dateTime":"TEXT", "xs:date":"TEXT"}, "mysql":{"id":"VARCHAR(16)", "xs:string":"VARCHAR(256)", "xs:integer":"BIGINT", "xs:dateTime":"DATETIME", "xs:date":"DATE"}, "postgres":{"id":"VARCHAR(16)", "xs:string":"VARCHAR(256)", "xs:integer":"BIGINT", "xs:dateTime":"TIMESTAMP", "xs:date":"DATE"}} 

if database_type == "sqlite3":
	connection = sqlite3.connect("localhost")
elif database_type == "mysql":
	connection = mdb.connect(host, username, password, database_name)
elif database_type == "postgres":