Jump to content

szkiddaj

Members
  • Posts

    1
  • Joined

  • Last visited

Details

  • Gang
    kirajok
  • Location
    nil
  • Interests
    Scripting

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

szkiddaj's Achievements

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody.

I ordered some spaghetti with marinara sauce and I got egg noodles and ketchup. I'm an average nobody. (2/54)

0

Reputation

  1. Hi, I want to create functions what makes sql queries easier, but I'm stuck with the update statement prepare. I tried unpack and table.concat, but didn't worked. -- Example: local core = exports.core; core:dbUpdate('table_name', { name = 'New Name' }, { name = 'Old Name' }); -- 3. arg stands for WHERE thing -- Core code function dbUpdate(tableName, data, where) if (dbConn and qID and tableName and data and type(data) == 'table' and where and where == 'table') then local keys, values, rows = concatTable(data); local wkeys, wvalues, wrows = concatTable(where); -- do magic tricks to prepare query string dbExec(dbConn, queryString); end end function concatTable(data) local keys, values, rows = {}, {}, 0; for i, v in pairs(data) do table.insert(keys, i); table.insert(values, v); rows = rows + 1; end return keys, values, rows; end
×
×
  • Create New...