#NEWLINE# def insert_tile_record( self , tile_dict ) : #NEWLINE# #INDENT# 'Creates a new tile record in the database.\n\n        The values of the fields in the new record are taken from\n        tile_dict. Returns the tile_id of the new record.' #NEWLINE# column_list = [ 'tile_id' , 'x_index' , 'y_index' , 'tile_type_id' , 'dataset_id' , 'tile_pathname' , 'tile_class_id' , 'tile_size' , 'ctime' ] #NEWLINE# columns = ( ( '(' + ',\n' . join ( column_list ) ) + ')' ) #NEWLINE# value_list = [ ] #NEWLINE# for column in column_list : #NEWLINE# #INDENT# if ( column == 'tile_id' ) : #NEWLINE# #INDENT# value_list . append ( "nextval('tile_id_seq')" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( column == 'ctime' ) : #NEWLINE# #INDENT# value_list . append ( 'now()' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value_list . append ( ( ( '%(' + column ) + ')s' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# values = ( ( '(' + ',\n' . join ( value_list ) ) + ')' ) #NEWLINE# sql = ( ( ( ( ( ( 'INSERT INTO tile ' + columns ) + '\n' ) + 'VALUES ' ) + values ) + '\n' ) + 'RETURNING tile_id;' ) #NEWLINE# result = self . execute_sql_single ( sql , tile_dict ) #NEWLINE# tile_id = result [ 0 ] #NEWLINE# return column_list