Skip to content

Commit 7deeb59

Browse files
committed
SV SQLite Schema
1 parent f0d1268 commit 7deeb59

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For now, the all modules are currently locked away behind only a usergroup == su
2727
| Network (Receivers) | :white_check_mark: | :white_check_mark: |
2828
| Timers | :white_check_mark: | :white_check_mark: |
2929
| Profiling | :x: | :x: |
30-
| SQLite Schema | :white_check_mark: | :x: |
30+
| SQLite Schema | :white_check_mark: | :white_check_mark: |
3131
| SQLite Data | :white_check_mark: | :x: |
3232
| SQLite Execute | :x: | :x: |
3333
| Remote SQL Schema | :x: | :x: |

lua/blobsprofiler/client/cl_blobsprofiler.lua

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ blobsProfiler.Menu.RCFunctions["Timers"] = {
525525
}
526526
}
527527
}
528-
blobsProfiler.Menu.RCFunctions["SQL_Schema"] = {
528+
blobsProfiler.Menu.RCFunctions["SQLite.Schema"] = { -- TODO: make submodules work with this
529529
["table"] = {
530530
{
531531
name = "SQL Create statement",
@@ -549,9 +549,9 @@ blobsProfiler.Menu.RCFunctions["SQL_Schema"] = {
549549
},
550550
icon = "icon16/table_lightning.png",
551551
condition = function(ref, node, realm)
552-
if not blobsProfiler[realm].SQLite.SchemaTables then return false end
552+
if not blobsProfiler[realm].SQLite.Schema.Tables then return false end
553553

554-
return blobsProfiler[realm].SQLite.SchemaTables[ref.key]
554+
return blobsProfiler[realm].SQLite.Schema.Tables[ref.key]
555555
end
556556
}
557557
--[[{
@@ -599,6 +599,7 @@ for k,v in ipairs(blobsProfiler.Menu.GlobalTypesToCondense) do
599599
blobsProfiler.Menu.TypeFolders.Client[v.type] = true
600600
blobsProfiler.Menu.TypeFolders.Server[v.type] = true
601601
end
602+
602603
local function nodeEntriesTableKeySort(a, b)
603604
local aIsTable = type(a.value) == 'table'
604605
local bIsTable = type(b.value) == 'table'
@@ -1130,26 +1131,6 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
11301131
local tabSettings = vgui.Create("DPropertySheet", tabMenu)
11311132
tabMenu:AddSheet("Settings", tabSettings, "icon16/cog.png")
11321133

1133-
tabClient.OnActiveTabChanged = function(s, pnlOld, pnlNew)
1134-
blobsProfiler.Menu.MenuFrame:SetTitle("blobsProfiler - " .. blobsProfiler.Menu.selectedRealm .. " - " .. pnlNew:GetText())
1135-
if not blobsProfiler.Client[pnlNew:GetText()] then
1136-
if blobsProfiler.Modules[pnlNew:GetText()].UpdateRealmData then
1137-
blobsProfiler.Modules[pnlNew:GetText()]:UpdateRealmData("Client")
1138-
end
1139-
end
1140-
end
1141-
1142-
tabServer.OnActiveTabChanged = function(s, pnlOld, pnlNew)
1143-
blobsProfiler.Menu.MenuFrame:SetTitle("blobsProfiler - " .. blobsProfiler.Menu.selectedRealm .. " - " .. pnlNew:GetText())
1144-
if not blobsProfiler.Server[pnlNew:GetText()] then
1145-
if blobsProfiler.Modules[pnlNew:GetText()].UpdateRealmData then
1146-
blobsProfiler.Modules[pnlNew:GetText()].retrievingData = true
1147-
blobsProfiler.Modules[pnlNew:GetText()]:UpdateRealmData("Server")
1148-
end
1149-
end
1150-
end
1151-
1152-
11531134
local luaStates = {
11541135
Client = tabClient,
11551136
Server = tabServer
@@ -1338,6 +1319,31 @@ concommand.Add("blobsprofiler", function(ply, cmd, args, argStr)
13381319
end
13391320
end
13401321

1322+
tabClient.OnActiveTabChanged = function(s, pnlOld, pnlNew)
1323+
blobsProfiler.Menu.MenuFrame:SetTitle("blobsProfiler - " .. blobsProfiler.Menu.selectedRealm .. " - " .. pnlNew:GetText())
1324+
if not blobsProfiler.Client[pnlNew:GetText()] then
1325+
if blobsProfiler.Modules[pnlNew:GetText()].UpdateRealmData then
1326+
blobsProfiler.Modules[pnlNew:GetText()]:UpdateRealmData("Client")
1327+
end
1328+
end
1329+
end
1330+
1331+
tabServer.OnActiveTabChanged = function(s, pnlOld, pnlNew)
1332+
blobsProfiler.Menu.MenuFrame:SetTitle("blobsProfiler - " .. blobsProfiler.Menu.selectedRealm .. " - " .. pnlNew:GetText())
1333+
if not blobsProfiler.Server[pnlNew:GetText()] then
1334+
if blobsProfiler.Modules[pnlNew:GetText()].UpdateRealmData then
1335+
blobsProfiler.Modules[pnlNew:GetText()].retrievingData = true
1336+
blobsProfiler.Modules[pnlNew:GetText()]:UpdateRealmData("Server")
1337+
end
1338+
end
1339+
1340+
if blobsProfiler.Modules[pnlNew:GetText()] and firstSubModule[pnlNew:GetText()] and firstSubModule[pnlNew:GetText()].data.UpdateRealmData then
1341+
if blobsProfiler.Server[pnlNew:GetText()][firstSubModule[pnlNew:GetText()].name] then return end
1342+
firstSubModule[pnlNew:GetText()].data.retrievingData = true
1343+
firstSubModule[pnlNew:GetText()].data:UpdateRealmData("Server")
1344+
end
1345+
end
1346+
13411347
tabMenu:OnActiveTabChanged(nil, tabMenu:GetActiveTab()) -- lol
13421348
end)
13431349

lua/blobsprofiler/shared/modules/bp_sqlite.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ blobsProfiler.RegisterSubModule("SQLite", "Schema", {
5050
end
5151
end,
5252
PrepServerData = function()
53-
53+
return buildSQLiteSchemaTable()
5454
end,
5555
PreloadClient = true,
5656
PreloadServer = false,
@@ -128,7 +128,7 @@ blobsProfiler.RegisterSubModule("SQLite", "Data", {
128128
blobsProfiler[luaState].SQLite = blobsProfiler[luaState].SQLite or {}
129129
blobsProfiler[luaState].SQLite.Data = blobsProfiler[luaState].SQLite.Data or {}
130130

131-
blobsProfiler[luaState].SQLite.Schema = blobsProfiler[luaState].SQLite.Schema or {}
131+
if not blobsProfiler[luaState].SQLite.Schema then return end
132132

133133
local schemaDataTable = blobsProfiler[luaState].SQLite.Schema
134134

0 commit comments

Comments
 (0)