Save point and read me edit, also modulification for the lib

This commit is contained in:
kake26 2024-12-11 21:49:08 -06:00
parent 5890221678
commit ff253ca498
Signed by: kake26
GPG key ID: E8AFC43591876B4D
4 changed files with 16 additions and 14 deletions

View file

@ -1,4 +1,5 @@
UseSQLiteDatabase()
OpenDatabase(0,"json.db","","",#PB_Database_SQLite)
Procedure InsertIntoDatabase(key$, parentKey$, type$, value$)
query$ = "INSERT INTO json_data (key, parent_key, type, value) VALUES ('" + key$ + "', '" + parentKey$ + "', '" + type$ + "', '" + value$ + "')"
@ -89,13 +90,15 @@ Procedure HandleNestedArray(JSONValue, parentKey$)
Next
EndProcedure
Procedure parse(json)
; worry about the database init later
OpenDatabase(0,"json.db","","",#PB_Database_SQLite)
LoadJSON(1,"test5.json");ParseJSON(1, json$) ; returns garbage without the PB ascii there not sure why
; ParseJSON(1, json$) ; returns garbage without the PB ascii there not sure why
;LoadJSON(1,"test2.json") ; returns garbage without the PB ascii there not sure why
ParseJSON(1,json)
ObjectValue = JSONValue(1)
If ExamineJSONMembers(ObjectValue)
@ -139,20 +142,16 @@ OpenDatabase(0,"json.db","","",#PB_Database_SQLite)
EndSelect
; Insert the parsed data into the SQLite database
;query$ = "INSERT INTO json_data (key, parent_key, type, value) VALUES ('" + key$ + "', '" + parentKey$ + "', '" + type$ + "', '" + value$ + "')"
;If DatabaseUpdate(0, query$) = 0
; Debug "Error inserting data: " + DatabaseError()
;EndIf
InsertIntoDatabase(key$,parentKey$,type$,value$)
Wend
EndIf
CloseDatabase(0)
EndProcedure
; IDE Options = PureBasic 6.12 LTS (Linux - x64)
; CursorPosition = 126
; FirstLine = 89
; CursorPosition = 149
; FirstLine = 113
; Folding = -
; EnableXP
; DPIAware
; DPIAware
; Executable = jsonlib