#NEWLINE# def insert_acquisition_record( self , acquisition_dict ) : #NEWLINE# #INDENT# 'Creates a new acquisition record in the database.\n\n        The values of the fields in the new record are taken from\n        acquisition_dict. Returns the acquisition_id of the new record.' #NEWLINE# column_list = [ 'acquisition_id' , 'satellite_id' , 'sensor_id' , 'x_ref' , 'y_ref' , 'start_datetime' , 'end_datetime' , 'll_lon' , 'll_lat' , 'lr_lon' , 'lr_lat' , 'ul_lon' , 'ul_lat' , 'ur_lon' , 'ur_lat' ] #NEWLINE# if ( acquisition_dict [ 'gcp_count' ] is not None ) : #NEWLINE# #INDENT# column_list . append ( 'gcp_count' ) #NEWLINE# #UNINDENT# if ( acquisition_dict [ 'mtl_text' ] is not None ) : #NEWLINE# #INDENT# column_list . append ( 'mtl_text' ) #NEWLINE# #UNINDENT# columns = ( ( '(' + ',\n' . join ( column_list ) ) + ')' ) #NEWLINE# value_list = [ ] #NEWLINE# for column in column_list : #NEWLINE# #INDENT# if ( column == 'acquisition_id' ) : #NEWLINE# #INDENT# value_list . append ( "nextval('acquisition_id_seq')" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value_list . append ( ( ( '%(' + column ) + ')s' ) ) #NEWLINE# #UNINDENT# #UNINDENT# values = ( ( '(' + ',\n' . join ( value_list ) ) + ')' ) #NEWLINE# sql = ( ( ( ( ( ( 'INSERT INTO acquisition ' + columns ) + '\n' ) + 'VALUES ' ) + values ) + '\n' ) + 'RETURNING acquisition_id;' ) #NEWLINE# result = self . execute_sql_single ( sql , acquisition_dict ) #NEWLINE# acquisition_id = result [ 0 ] #NEWLINE# return acquisition_id