         # File lib/protocols/postgres.rb, line 129
    129:         def connect db, user, psw=nil
    130:                 d = EM::DefaultDeferrable.new
    131:                 d.timeout 15
    132:
    133:                 if @pending_query || @pending_conn
    134:                         d.succeed false, "Operation already in progress"
    135:                 else
    136:                         @pending_conn = d
    137:                         prms = {"user"=>user, "database"=>db}
    138:                         @user = user
    139:                         if psw
    140:                                 @password = psw
    141:                                 #prms["password"] = psw
    142:                         end
    143:                         send_data PostgresPR::StartupMessage.new( 3 << 16, prms ).dump
    144:                 end
    145:
    146:                 d
    147:         end