#NEWLINE# @ classmethod #NEWLINE# def _by_param( self , param , value , table = 'pastes' , fetch_all = False ) : #NEWLINE# #INDENT# "\n        Executes SQL query equivalent to\n        'SELECT * FROM $table WHERE $param = $value'\n\n        Only trusted input should be used for $table and $param\n\n        " #NEWLINE# cur = self . _cursor ( ) #NEWLINE# cur . execute ( 'SELECT * FROM {0} WHERE {1} = %s' . format ( table , param ) , ( value , ) ) #NEWLINE# if fetch_all : #NEWLINE# #INDENT# result = cur . fetchall ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = cur . fetchone ( ) #NEWLINE# #UNINDENT# cur . close ( ) #NEWLINE# return result