Jump to content

mysql error


fikasS

Recommended Posts

Hi, I have a little problem! dbPoll failed; The "character names" field has no default value

First of all, what is its default value? because this is an outdated mysql that was perfected 5 years ago. dbquery, db_free db_pool functions. Thank you in advance for your help.

 

CODE:

local hostname = "127.0.0.1"
local username = "...username"
local password = ".....pass"
local database = "databasename"
local results = {}

addEventHandler("onResourceStart", resourceRoot, function()
    dbHandler = dbConnect("mysql","dbname=".. database ..";host="..hostname, username, password, "autoreconnect=1")
    if not dbHandler then
        outputDebugString("#1 failed connect")
        cancelEvent(true)
    else
        outputDebugString("#2 succesful connect")
    end
end)

function query_free(q,poll)
    local this = #results + 1
    results[this] = dbQuery(dbHandler, q)
    if poll then
        local result, num_affected_rows, last_insert_id = dbPoll(results[this], -1)
        if result == nil then
            dbFree(results[this])
            return this, nil
        elseif result == false then
            dbFree(results[this])
            return this, nil
        else
            dbFree(results[this])
            return this, tonumber(last_insert_id)
        end
    end
    dbFree(results[this])
    return this
end

function getConnection()
    return dbHandler
end

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...