Save point and read me edit, also modulification for the lib
This commit is contained in:
parent
5890221678
commit
ff253ca498
4 changed files with 16 additions and 14 deletions
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
## NOTES
|
||||
|
||||
This is not perfect, but seems to work for a the tests I've run against it.
|
BIN
json.db
BIN
json.db
Binary file not shown.
BIN
jsonlib
Executable file
BIN
jsonlib
Executable file
Binary file not shown.
27
jsonlib.pb
27
jsonlib.pb
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue