~jan-kneschke/mysql-proxy/packet-tracking-assertions

« back to all changes in this revision

Viewing changes to tests/suite/base/t/change_user.lua

  • Committer: Kay Roepke
  • Author(s): Jan Kneschke
  • Date: 2008-01-23 22:00:28 UTC
  • Revision ID: kay@mysql.com-20080123220028-hq2xqb69apa75fnx
first round on mysql-shell based on the proxy code

this is mostly a verification if the proxy-code is flexible enough to handle 
all three scenarios of: client, server and forwarding (proxy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require("posix")
2
 
 
3
 
function read_query (packet)
4
 
        -- ack the packets
5
 
        if packet:byte() ~= proxy.COM_QUERY then
6
 
                proxy.response = {
7
 
                        type = proxy.MYSQLD_PACKET_OK
8
 
                }
9
 
                return proxy.PROXY_SEND_RESULT
10
 
        end
11
 
 
12
 
        local pw = posix.getpwuid( posix.getuid() )
13
 
        local user
14
 
        if pw then
15
 
                user = pw['name']
16
 
        else
17
 
                user = "nil"
18
 
        end
19
 
 
20
 
        proxy.response.type = proxy.MYSQLD_PACKET_OK
21
 
        proxy.response.resultset = {
22
 
                fields = {
23
 
                        { type = proxy.MYSQL_TYPE_STRING, name = "user", },
24
 
                },
25
 
                rows = { { user }  }
26
 
        }
27
 
        return proxy.PROXY_SEND_RESULT
28
 
end