327 if dbcnx.logged_user != source['db-user']: |
327 if dbcnx.logged_user != source['db-user']: |
328 helper.create_database(cursor, dbname, source['db-user'], |
328 helper.create_database(cursor, dbname, source['db-user'], |
329 source['db-encoding']) |
329 source['db-encoding']) |
330 else: |
330 else: |
331 helper.create_database(cursor, dbname, |
331 helper.create_database(cursor, dbname, |
332 encoding=source['db-encoding']) |
332 dbencoding=source['db-encoding']) |
333 dbcnx.commit() |
333 dbcnx.commit() |
334 print '-> database %s created.' % dbname |
334 print '-> database %s created.' % dbname |
335 except: |
335 except: |
336 dbcnx.rollback() |
336 dbcnx.rollback() |
337 raise |
337 raise |
338 cnx = system_source_cnx(source, special_privs='LANGUAGE C', verbose=verbose) |
338 cnx = system_source_cnx(source, special_privs='LANGUAGE C', verbose=verbose) |
339 cursor = cnx.cursor() |
339 cursor = cnx.cursor() |
340 dbhelper.init_fti_extensions(cursor) |
340 helper.init_fti_extensions(cursor) |
341 # postgres specific stuff |
341 # postgres specific stuff |
342 if driver == 'postgres': |
342 if driver == 'postgres': |
343 # install plpythonu/plpgsql language if not installed by the cube |
343 # install plpythonu/plpgsql language if not installed by the cube |
344 langs = sys.platform == 'win32' and ('plpgsql',) or ('plpythonu', 'plpgsql') |
344 langs = sys.platform == 'win32' and ('plpgsql',) or ('plpythonu', 'plpgsql') |
345 for extlang in langs: |
345 for extlang in langs: |