Esempio n. 1
0
def initDb(db):
	if db == "mysql":
		return mysql.MySQL(), False
	elif db == "postgis" or db == "postgresql":
		return postgis.Postgis(), False
	elif db == "sqlite" or db == "spatialite":
		return spatialite.Spatialite('benchmark.db'), True
	elif db == "monetdb":
		return monet_db.Monet_db(), False
Esempio n. 2
0
def runSpatialiteMain(numberOfExecutions, params):
    print('Started spatialite Benchmark')
    db = spatialite.Spatialite(':memory:')
    db.loadDiskData('benchmark.db')
    spatialiteResults = db.runQueries(spatialitequeries(), numberOfExecutions,
                                      params)
    db.disconnect()
    print('Finished spatialite Benchmark')
    output.printSingleResult(spatialiteResults)
    return spatialiteResults
def runSpatialiteMain(numberOfExecutions):
    enableIndex = False
    print('Starting spatialite Benchmark - main-memory')
    spatialiteDBMain = spatialite.Spatialite(':memory:')
    # spatialiteDBMain = spatialite.Spatialite('benchmark.db')
    spatialiteDBMain.setUpSoccerData(enableIndex)
    spatialiteResultsMain = spatialiteDBMain.runQueries(
        spatialitequeries(), numberOfExecutions)
    spatialiteDBMain.disconnect()
    print('Finished spatialite Benchmark - main-memory')
    output.printSingleResult(spatialiteResultsMain)
    return spatialiteResultsMain
def initDestinationDb(destination_db):
    if destination_db == "postgis" or destination_db == "postgresql":
        db = postgis.Postgis()
        param = "%s"
        spatial_column_extra = False
        buffer_insteadof_string = False
        geomFunction = "ST_GeomFromText"
        return db, {
            'param': param,
            'spatial_column_extra': spatial_column_extra,
            'buffer_insteadof_string': buffer_insteadof_string,
            'geomFunction': geomFunction
        }
    elif destination_db == "spatialite" or destination_db == "sqlite":
        db = spatialite.Spatialite('benchmark.db')
        param = "?"
        spatial_column_extra = True
        buffer_insteadof_string = True
        init = 'SELECT InitSpatialMetadata()'
        db.cursor.execute(init)
        geomFunction = "ST_GeomFromText"
        return db, {
            'param': param,
            'spatial_column_extra': spatial_column_extra,
            'buffer_insteadof_string': buffer_insteadof_string,
            'geomFunction': geomFunction
        }
    elif destination_db == "monetdb":
        db = monet_db.Monet_db()
        param = "%s"
        spatial_column_extra = False
        buffer_insteadof_string = False
        geomFunction = "GeomFromText"
        return db, {
            'param': param,
            'spatial_column_extra': spatial_column_extra,
            'buffer_insteadof_string': buffer_insteadof_string,
            'geomFunction': geomFunction
        }
    else:
        print "The output database is not supported!"
        sys.exit(2)