#NEWLINE# def insert_dataset_record( self , dataset_dict ) : #NEWLINE# #INDENT# 'Creates a new dataset record in the database.\n\n        The values of the fields in the new record are taken from\n        dataset_dict. Returns the dataset_id of the new record.' #NEWLINE# column_list = [ 'dataset_id' , 'acquisition_id' , 'dataset_path' , 'level_id' , 'datetime_processed' , 'dataset_size' , 'crs' , 'll_x' , 'll_y' , 'lr_x' , 'lr_y' , 'ul_x' , 'ul_y' , 'ur_x' , 'ur_y' , 'x_pixels' , 'y_pixels' , 'xml_text' ] #NEWLINE# columns = ( ( '(' + ',\n' . join ( column_list ) ) + ')' ) #NEWLINE# value_list = [ ] #NEWLINE# for column in column_list : #NEWLINE# #INDENT# if ( column == 'dataset_id' ) : #NEWLINE# #INDENT# value_list . append ( "nextval('dataset_id_seq')" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value_list . append ( ( ( '%(' + column ) + ')s' ) ) #NEWLINE# #UNINDENT# #UNINDENT# values = ( ( '(' + ',\n' . join ( value_list ) ) + ')' ) #NEWLINE# sql = ( ( ( ( ( ( 'INSERT INTO dataset ' + columns ) + '\n' ) + 'VALUES ' ) + values ) + '\n' ) + 'RETURNING dataset_id;' ) #NEWLINE# result = self . execute_sql_single ( sql , column ) #NEWLINE# dataset_id = result [ 0 ] #NEWLINE# return dataset_id