Git Product home page Git Product logo

Comments (4)

agentzh avatar agentzh commented on July 25, 2024

@Pronan Will you prepare a standalone and minimal test case for the existing test suite so that we can easily run and reproduce the problem on our side? Thanks!

from lua-resty-mysql.

xiangnanscu avatar xiangnanscu commented on July 25, 2024

@agentzh Hello, chun ge. Sorry I should do this when I report this. Both windows 10 and Ubuntu 14.04 are the same. Version Openresty 1.11.2.2

worker_processes  1;
user root root;

events {worker_connections  1024;}

http {

    access_log  logs/access.log;
    error_log  logs/error.log;

    client_body_temp_path tmp/client_body_temp;
    fastcgi_temp_path tmp/fastcgi_temp;
    proxy_temp_path tmp/proxy_temp;
    scgi_temp_path tmp/scgi_temp;
    uwsgi_temp_path tmp/uwsgi_temp;
    
    include mime.types;
    
    server {
        listen       8888;
        server_name  localhost;

        
        location / {
            content_by_lua_block {

local mysql_driver = require "resty.mysql"

local connect_table = { 
        host     = "127.0.0.1", 
        port     = 3306, 
        database = "test", 
        user     = 'root', 
        password = '', }
local connect_timeout = 1000
local idle_timeout = 10000
local pool_size = 50

local function query(statement, compact, rows)
    local db, res, ok, err, errno, sqlstate
    db, err = mysql_driver:new()
    if not db then
        return nil, err
    end
    db:set_timeout(connect_timeout) 
    res, err, errno, sqlstate = db:connect(connect_table)
    if not res then
        return nil, err, errno, sqlstate
    end
    db.compact = compact
    res, err, errno, sqlstate =  db:query(statement, rows)
    if res ~= nil then
        ok, err = db:set_keepalive(idle_timeout, pool_size)
        if not ok then
            return nil, 'fail to set_keepalive:'..err
        end
    end
    return res, err, errno, sqlstate
end

local statements = {
    'drop table if exists test_usr',
    'create table test_usr (name varchar(10))',
    'insert into test_usr values ("name1")',
    'update test_usr set name="foo"',
}

local res, err
for i, stm in ipairs(statements) do
    res, err = query(stm)
    if not res then
        return ngx.say(err)
    else

    end
end

ngx.say(res.message)

            }
        }
    
    
    }

    
}

from lua-resty-mysql.

xiangnanscu avatar xiangnanscu commented on July 25, 2024

@agentzh you will see (Rows matched: 1 Changed: 1 Warnings: 0 in the browser.

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

@Pronan Fixed in commit 79c4a37. Thanks for the report and test case!

from lua-resty-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.