#NEWLINE# def register( self , bdb ) : #NEWLINE# #INDENT# with bdb . savepoint ( ) : #NEWLINE# #INDENT# schema_sql = 'SELECT version FROM bayesdb_metamodel WHERE name = ?' #NEWLINE# cursor = bdb . sql_execute ( schema_sql , ( self . name ( ) , ) ) #NEWLINE# version = None #NEWLINE# try : #NEWLINE# #INDENT# row = cursor . next ( ) #NEWLINE# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# version = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# version = row [ 0 ] #NEWLINE# #UNINDENT# assert ( version is not None ) #NEWLINE# if ( version == 0 ) : #NEWLINE# #INDENT# for stmt in nig_normal_schema_1 . split ( ';' ) : #NEWLINE# #INDENT# bdb . sql_execute ( stmt ) #NEWLINE# #UNINDENT# version = 1 #NEWLINE# #UNINDENT# if ( version != 1 ) : #NEWLINE# #INDENT# raise BQLError ( bdb , ( 'NIG-Normal already installed with unknown schema version: %d' % ( stmt , ) ) )