Skip to content

Commit

Permalink
fix(esx_multicharacter/server/modules/database): improve database nam…
Browse files Browse the repository at this point in the history
…e extraction
  • Loading branch information
RrybaN committed Nov 29, 2024
1 parent 2bfd7ef commit 11b0bb5
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions [core]/esx_multicharacter/server/modules/database.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@ function Database:GetConnection()

self.name = connectionString:sub(connectionString:find("/") + 1, -1):gsub("[%?]+[%w%p]*$", "")
self.found = true
elseif connectionString:find("database=") then
self.name = connectionString:match("database=([^;?]+)"):gsub("[%?]+[%w%p]*$", "")
self.found = true
else
local connectionExtracted = { string.strsplit(";", connectionString) }

for i = 1, #connectionExtracted do
local v = connectionExtracted[i]
if v:match("database") then
self.name = connectionString:sub(connectionString:find("/") + 1, -1):gsub("[%?]+[%w%p]*$", "")
self.found = true
break
end
end
error(connectionString .. "\n^1Unable to start Multicharacter - unable to get database name from mysql_connection_string^0", 0)
end
end

Expand Down

0 comments on commit 11b0bb5

Please sign in to comment.