Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fb86a496
Commit
fb86a496
authored
Nov 07, 2020
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-fix compile error (overloaded-virtual)
parent
e4294729
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
128 deletions
+112
-128
storage/connect/json.cpp
storage/connect/json.cpp
+27
-15
storage/connect/json.h
storage/connect/json.h
+7
-35
storage/connect/jsonudf.cpp
storage/connect/jsonudf.cpp
+41
-41
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+37
-37
No files found.
storage/connect/json.cpp
View file @
fb86a496
...
...
@@ -531,7 +531,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i)
sprintf
(
g
->
Message
,
"Unexpected value near %.*s"
,
ARGS
);
throw
1
;
}
else
jarp
->
AddValue
(
g
,
ParseValue
(
g
,
i
));
jarp
->
Add
Array
Value
(
g
,
ParseValue
(
g
,
i
));
level
=
(
b
)
?
1
:
2
;
break
;
...
...
@@ -886,7 +886,7 @@ bool JDOC::SerializeArray(PJAR jarp, bool b)
}
// endif b
if
(
SerializeValue
(
jarp
->
GetValue
(
i
)))
if
(
SerializeValue
(
jarp
->
Get
Array
Value
(
i
)))
return
true
;
}
// endfor i
...
...
@@ -1010,7 +1010,7 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
PJAR
jarp
=
new
(
g
)
JARRAY
();
for
(
PJPR
jpp
=
First
;
jpp
;
jpp
=
jpp
->
Next
)
jarp
->
AddValue
(
g
,
new
(
g
)
JVALUE
(
g
,
jpp
->
Key
));
jarp
->
Add
Array
Value
(
g
,
new
(
g
)
JVALUE
(
g
,
jpp
->
Key
));
jarp
->
InitArray
(
g
);
return
jarp
;
...
...
@@ -1024,7 +1024,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
PJAR
jarp
=
new
(
g
)
JARRAY
();
for
(
PJPR
jpp
=
First
;
jpp
;
jpp
=
jpp
->
Next
)
jarp
->
AddValue
(
g
,
jpp
->
Val
);
jarp
->
Add
Array
Value
(
g
,
jpp
->
Val
);
jarp
->
InitArray
(
g
);
return
jarp
;
...
...
@@ -1033,7 +1033,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
/***********************************************************************/
/* Get the value corresponding to the given key. */
/***********************************************************************/
PJVAL
JOBJECT
::
GetValue
(
const
char
*
key
)
PJVAL
JOBJECT
::
Get
Key
Value
(
const
char
*
key
)
{
for
(
PJPR
jp
=
First
;
jp
;
jp
=
jp
->
Next
)
if
(
!
strcmp
(
jp
->
Key
,
key
))
...
...
@@ -1111,7 +1111,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
PJOB
jobp
=
(
PJOB
)
jsp
;
for
(
PJPR
jpp
=
jobp
->
First
;
jpp
;
jpp
=
jpp
->
Next
)
SetValue
(
g
,
jpp
->
Val
,
jpp
->
Key
);
Set
Key
Value
(
g
,
jpp
->
Val
,
jpp
->
Key
);
return
false
;
}
// end of Marge;
...
...
@@ -1119,7 +1119,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/
/* Set or add a value corresponding to the given key. */
/***********************************************************************/
void
JOBJECT
::
SetValue
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
)
void
JOBJECT
::
Set
Key
Value
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
)
{
PJPR
jp
;
...
...
@@ -1166,6 +1166,18 @@ bool JOBJECT::IsNull(void)
/* -------------------------- Class JARRAY --------------------------- */
/***********************************************************************/
/* JARRAY constructor. */
/***********************************************************************/
JARRAY
::
JARRAY
(
void
)
:
JSON
()
{
Type
=
TYPE_JAR
;
Size
=
0
;
Alloc
=
0
;
First
=
Last
=
NULL
;
Mvals
=
NULL
;
}
// end of JARRAY constructor
/***********************************************************************/
/* Return the number of values in this object. */
/***********************************************************************/
...
...
@@ -1216,7 +1228,7 @@ void JARRAY::InitArray(PGLOBAL g)
/***********************************************************************/
/* Get the Nth value of an Array. */
/***********************************************************************/
PJVAL
JARRAY
::
GetValue
(
int
i
)
PJVAL
JARRAY
::
Get
Array
Value
(
int
i
)
{
if
(
Mvals
&&
i
>=
0
&&
i
<
Size
)
return
Mvals
[
i
];
...
...
@@ -1227,7 +1239,7 @@ PJVAL JARRAY::GetValue(int i)
/***********************************************************************/
/* Add a Value to the Array Value list. */
/***********************************************************************/
PJVAL
JARRAY
::
AddValue
(
PGLOBAL
g
,
PJVAL
jvp
,
int
*
x
)
PJVAL
JARRAY
::
Add
Array
Value
(
PGLOBAL
g
,
PJVAL
jvp
,
int
*
x
)
{
if
(
!
jvp
)
jvp
=
new
(
g
)
JVALUE
;
...
...
@@ -1271,7 +1283,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
PJAR
arp
=
(
PJAR
)
jsp
;
for
(
int
i
=
0
;
i
<
arp
->
size
();
i
++
)
Add
Value
(
g
,
arp
->
Get
Value
(
i
));
Add
ArrayValue
(
g
,
arp
->
GetArray
Value
(
i
));
InitArray
(
g
);
return
false
;
...
...
@@ -1280,7 +1292,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/
/* Set the nth Value of the Array Value list. */
/***********************************************************************/
bool
JARRAY
::
SetValue
(
PGLOBAL
g
,
PJVAL
jvp
,
int
n
)
bool
JARRAY
::
Set
Array
Value
(
PGLOBAL
g
,
PJVAL
jvp
,
int
n
)
{
int
i
=
0
;
PJVAL
jp
,
*
jpp
=
&
First
;
...
...
@@ -1340,7 +1352,7 @@ PSZ JARRAY::GetText(PGLOBAL g, PSTRG text)
/***********************************************************************/
bool
JARRAY
::
DeleteValue
(
int
n
)
{
PJVAL
jvp
=
GetValue
(
n
);
PJVAL
jvp
=
Get
Array
Value
(
n
);
if
(
jvp
)
{
jvp
->
Del
=
true
;
...
...
@@ -1365,7 +1377,7 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */
/***********************************************************************/
/* Constructor for a J
SON.
*/
/* Constructor for a J
VALUE.
*/
/***********************************************************************/
JVALUE
::
JVALUE
(
PJSON
jsp
)
:
JSON
()
{
...
...
@@ -1383,7 +1395,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON()
}
// end of JVALUE constructor
/***********************************************************************/
/* Constructor for a
Val with a given string or numeric value.
*/
/* Constructor for a
JVALUE with a given string or numeric value.
*/
/***********************************************************************/
JVALUE
::
JVALUE
(
PGLOBAL
g
,
PVL
vlp
)
:
JSON
()
{
...
...
@@ -1395,7 +1407,7 @@ JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
}
// end of JVALUE constructor
/***********************************************************************/
/* Constructor for a
Value with a given string or numeric value.
*/
/* Constructor for a
JVALUE with a given string or numeric value.
*/
/***********************************************************************/
JVALUE
::
JVALUE
(
PGLOBAL
g
,
PVAL
valp
)
:
JSON
()
{
Jsp
=
NULL
;
...
...
storage/connect/json.h
View file @
fb86a496
...
...
@@ -140,36 +140,16 @@ class JSON : public BLOCK {
// Methods
virtual
int
size
(
void
)
{
return
1
;
}
// virtual JTYP GetValType(void) { X return TYPE_JSON; }
// virtual void InitArray(PGLOBAL g) { X }
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
// virtual PJPR AddPair(PGLOBAL g, PCSZ key) { X return NULL; }
virtual
void
Clear
(
void
)
{
X
}
// virtual PJAR GetKeyList(PGLOBAL g) { X return NULL; }
// virtual PJAR GetValList(PGLOBAL g) { X return NULL; }
// virtual PJVAL GetValue(const char* key) { X return NULL; }
virtual
PJOB
GetObject
(
void
)
{
return
NULL
;
}
virtual
PJAR
GetArray
(
void
)
{
return
NULL
;
}
virtual
PJVAL
GetValue
(
int
i
)
{
X
return
NULL
;
}
virtual
PJVAL
Get
Array
Value
(
int
i
)
{
X
return
NULL
;
}
virtual
int
GetSize
(
bool
b
)
{
X
return
0
;
}
//virtual PVL GetVal(void) { X return NULL; }
virtual
PJSON
GetJsp
(
void
)
{
X
return
NULL
;
}
// virtual PJSON GetJson(void) { X return NULL; }
virtual
PJPR
GetFirst
(
void
)
{
X
return
NULL
;
}
// virtual int GetInteger(void) { X return 0; }
// virtual double GetFloat() { X return 0.0; }
// virtual PSZ GetString(PGLOBAL g, char *buff = NULL) { X return NULL; }
virtual
PSZ
GetText
(
PGLOBAL
g
,
PSTRG
text
)
{
X
return
NULL
;
}
virtual
bool
Merge
(
PGLOBAL
g
,
PJSON
jsp
)
{
X
return
true
;
}
// virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; }
// virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key) { X }
// virtual void SetVal(PVL vlp) { X }
// virtual void SetValue(PGLOBAL g, PVAL valp) { X }
virtual
void
SetValue
(
PJSON
jsp
)
{
X
}
// virtual void SetString(PGLOBAL g, PSZ s, short c) { X }
// virtual void SetInteger(PGLOBAL g, int n) { X }
// virtual void SetFloat(PGLOBAL g, double f) { X }
// virtual void DeleteKey(PCSZ k) { X }
virtual
bool
DeleteValue
(
int
i
)
{
X
return
true
;
}
virtual
bool
IsNull
(
void
)
{
X
return
true
;
}
...
...
@@ -188,9 +168,6 @@ class JOBJECT : public JSON {
JOBJECT
(
void
)
:
JSON
()
{
Type
=
TYPE_JOB
;
First
=
Last
=
NULL
;
}
JOBJECT
(
int
i
)
:
JSON
(
i
)
{}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods
virtual
void
Clear
(
void
)
{
First
=
Last
=
NULL
;}
//virtual JTYP GetValType(void) {return TYPE_JOB;}
...
...
@@ -203,10 +180,10 @@ class JOBJECT : public JSON {
// Specific
PJPR
AddPair
(
PGLOBAL
g
,
PCSZ
key
);
PJVAL
GetValue
(
const
char
*
key
);
PJVAL
Get
Key
Value
(
const
char
*
key
);
PJAR
GetKeyList
(
PGLOBAL
g
);
PJAR
GetValList
(
PGLOBAL
g
);
void
SetValue
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
);
void
Set
Key
Value
(
PGLOBAL
g
,
PJVAL
jvp
,
PCSZ
key
);
void
DeleteKey
(
PCSZ
k
);
protected:
...
...
@@ -220,28 +197,23 @@ class JOBJECT : public JSON {
class
JARRAY
:
public
JSON
{
friend
class
SWAP
;
public:
JARRAY
(
void
)
:
JSON
()
{
Type
=
TYPE_JAR
;
Alloc
=
0
;
First
=
Last
=
NULL
;
Mvals
=
NULL
;
}
JARRAY
(
void
);
JARRAY
(
int
i
)
:
JSON
(
i
)
{}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods
virtual
void
Clear
(
void
)
{
First
=
Last
=
NULL
;
Size
=
0
;}
virtual
int
size
(
void
)
{
return
Size
;
}
//virtual JTYP GetType(void) {return TYPE_JAR;}
virtual
PJAR
GetArray
(
void
)
{
return
this
;}
virtual
int
GetSize
(
bool
b
);
virtual
PJVAL
GetValue
(
int
i
);
virtual
PJVAL
Get
Array
Value
(
int
i
);
virtual
PSZ
GetText
(
PGLOBAL
g
,
PSTRG
text
);
virtual
bool
Merge
(
PGLOBAL
g
,
PJSON
jsp
);
virtual
bool
DeleteValue
(
int
n
);
virtual
bool
IsNull
(
void
);
// Specific
PJVAL
AddValue
(
PGLOBAL
g
,
PJVAL
jvp
=
NULL
,
int
*
x
=
NULL
);
bool
SetValue
(
PGLOBAL
g
,
PJVAL
jvp
,
int
i
);
PJVAL
Add
Array
Value
(
PGLOBAL
g
,
PJVAL
jvp
=
NULL
,
int
*
x
=
NULL
);
bool
Set
Array
Value
(
PGLOBAL
g
,
PJVAL
jvp
,
int
i
);
void
InitArray
(
PGLOBAL
g
);
protected:
...
...
storage/connect/jsonudf.cpp
View file @
fb86a496
This diff is collapsed.
Click to expand it.
storage/connect/tabjson.cpp
View file @
fb86a496
...
...
@@ -240,7 +240,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
if
(
tjsp
->
MakeDocument
(
g
))
return
0
;
jsp
=
(
tjsp
->
GetDoc
())
?
tjsp
->
GetDoc
()
->
GetValue
(
0
)
:
NULL
;
jsp
=
(
tjsp
->
GetDoc
())
?
tjsp
->
GetDoc
()
->
Get
Array
Value
(
0
)
:
NULL
;
}
else
{
if
(
!
((
tdp
->
Lrecl
=
GetIntegerTableOption
(
g
,
topt
,
"Lrecl"
,
0
))))
{
if
(
!
mgo
)
{
...
...
@@ -365,7 +365,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
}
// endswitch ReadDB
}
else
jsp
=
tjsp
->
GetDoc
()
->
GetValue
(
i
);
jsp
=
tjsp
->
GetDoc
()
->
Get
Array
Value
(
i
);
if
(
!
(
row
=
(
jsp
)
?
jsp
->
GetObject
()
:
NULL
))
break
;
...
...
@@ -483,7 +483,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
strncat
(
fmt
,
(
tdp
->
Uri
?
sep
:
"[*]"
),
n
);
}
if
(
Find
(
g
,
jar
->
GetValue
(
k
),
""
,
j
))
if
(
Find
(
g
,
jar
->
Get
Array
Value
(
k
),
""
,
j
))
return
true
;
*
p
=
*
pc
=
0
;
...
...
@@ -922,7 +922,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
if
(
*
objpath
!=
'['
&&
!
IsNum
(
objpath
))
{
// objpass is a key
val
=
(
jsp
->
GetType
()
==
TYPE_JOB
)
?
jsp
->
GetObject
()
->
GetValue
(
objpath
)
:
NULL
;
jsp
->
GetObject
()
->
Get
Key
Value
(
objpath
)
:
NULL
;
}
else
{
if
(
*
objpath
==
'['
)
{
if
(
objpath
[
strlen
(
objpath
)
-
1
]
==
']'
)
...
...
@@ -932,7 +932,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
}
// endif [
val
=
(
jsp
->
GetType
()
==
TYPE_JAR
)
?
jsp
->
GetArray
()
->
GetValue
(
atoi
(
objpath
)
-
B
)
:
NULL
;
jsp
->
GetArray
()
->
Get
Array
Value
(
atoi
(
objpath
)
-
B
)
:
NULL
;
}
// endif objpath
jsp
=
(
val
)
?
val
->
GetJson
()
:
NULL
;
...
...
@@ -1128,7 +1128,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val
->
SetValue
(
objp
);
val
=
new
(
g
)
JVALUE
;
objp
->
SetValue
(
g
,
val
,
objpath
);
objp
->
Set
Key
Value
(
g
,
val
,
objpath
);
}
else
{
if
(
*
objpath
==
'['
)
{
// Old style
...
...
@@ -1150,7 +1150,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val
=
new
(
g
)
JVALUE
;
i
=
atoi
(
objpath
)
-
B
;
arp
->
SetValue
(
g
,
val
,
i
);
arp
->
Set
Array
Value
(
g
,
val
,
i
);
arp
->
InitArray
(
g
);
}
// endif objpath
...
...
@@ -1703,7 +1703,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
val
=
new
(
G
)
JVALUE
(
row
);
}
else
val
=
((
PJOB
)
row
)
->
GetValue
(
Nodes
[
i
].
Key
);
val
=
((
PJOB
)
row
)
->
Get
Key
Value
(
Nodes
[
i
].
Key
);
break
;
case
TYPE_JAR
:
...
...
@@ -1711,7 +1711,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
if
(
!
Nodes
[
i
].
Key
)
{
if
(
Nodes
[
i
].
Op
==
OP_EQ
)
val
=
arp
->
GetValue
(
Nodes
[
i
].
Rank
);
val
=
arp
->
Get
Array
Value
(
Nodes
[
i
].
Rank
);
else
if
(
Nodes
[
i
].
Op
==
OP_EXP
)
return
ExpandArray
(
g
,
arp
,
i
);
else
...
...
@@ -1719,7 +1719,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
}
else
{
// Unexpected array, unwrap it as [0]
val
=
arp
->
GetValue
(
0
);
val
=
arp
->
Get
Array
Value
(
0
);
i
--
;
}
// endif's
...
...
@@ -1757,7 +1757,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
return
Value
;
}
// endif ars
if
(
!
(
jvp
=
arp
->
GetValue
((
Nodes
[
n
].
Rx
=
Nodes
[
n
].
Nx
))))
{
if
(
!
(
jvp
=
arp
->
Get
Array
Value
((
Nodes
[
n
].
Rx
=
Nodes
[
n
].
Nx
))))
{
strcpy
(
g
->
Message
,
"Logical error expanding array"
);
throw
666
;
}
// endif jvp
...
...
@@ -1801,7 +1801,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
ars
,
op
,
nextsame
);
for
(
i
=
0
;
i
<
ars
;
i
++
)
{
jvrp
=
arp
->
GetValue
(
i
);
jvrp
=
arp
->
Get
Array
Value
(
i
);
if
(
trace
(
1
))
htrc
(
"i=%d nv=%d
\n
"
,
i
,
nv
);
...
...
@@ -1901,20 +1901,20 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
// Expected Array was not there, wrap the value
continue
;
val
=
((
PJOB
)
row
)
->
GetValue
(
Nodes
[
i
].
Key
);
val
=
((
PJOB
)
row
)
->
Get
Key
Value
(
Nodes
[
i
].
Key
);
break
;
case
TYPE_JAR
:
arp
=
(
PJAR
)
row
;
if
(
!
Nodes
[
i
].
Key
)
{
if
(
Nodes
[
i
].
Op
==
OP_EQ
)
val
=
arp
->
GetValue
(
Nodes
[
i
].
Rank
);
val
=
arp
->
Get
Array
Value
(
Nodes
[
i
].
Rank
);
else
val
=
arp
->
GetValue
(
Nodes
[
i
].
Rx
);
val
=
arp
->
Get
Array
Value
(
Nodes
[
i
].
Rx
);
}
else
{
// Unexpected array, unwrap it as [0]
val
=
arp
->
GetValue
(
0
);
val
=
arp
->
Get
Array
Value
(
0
);
i
--
;
}
// endif Nodes
...
...
@@ -1941,9 +1941,9 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
nwr
=
new
(
G
)
JOBJECT
;
if
(
row
->
GetType
()
==
TYPE_JOB
)
{
((
PJOB
)
row
)
->
SetValue
(
G
,
new
(
G
)
JVALUE
(
nwr
),
Nodes
[
i
-
1
].
Key
);
((
PJOB
)
row
)
->
Set
Key
Value
(
G
,
new
(
G
)
JVALUE
(
nwr
),
Nodes
[
i
-
1
].
Key
);
}
else
if
(
row
->
GetType
()
==
TYPE_JAR
)
{
((
PJAR
)
row
)
->
AddValue
(
G
,
new
(
G
)
JVALUE
(
nwr
));
((
PJAR
)
row
)
->
Add
Array
Value
(
G
,
new
(
G
)
JVALUE
(
nwr
));
((
PJAR
)
row
)
->
InitArray
(
G
);
}
else
{
strcpy
(
g
->
Message
,
"Wrong type when writing new row"
);
...
...
@@ -2008,14 +2008,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if
(
arp
)
{
if
(
Nod
>
1
&&
Nodes
[
Nod
-
2
].
Op
==
OP_EQ
)
arp
->
SetValue
(
G
,
new
(
G
)
JVALUE
(
jsp
),
Nodes
[
Nod
-
2
].
Rank
);
arp
->
Set
Array
Value
(
G
,
new
(
G
)
JVALUE
(
jsp
),
Nodes
[
Nod
-
2
].
Rank
);
else
arp
->
AddValue
(
G
,
new
(
G
)
JVALUE
(
jsp
));
arp
->
Add
Array
Value
(
G
,
new
(
G
)
JVALUE
(
jsp
));
arp
->
InitArray
(
G
);
}
else
if
(
objp
)
{
if
(
Nod
>
1
&&
Nodes
[
Nod
-
2
].
Key
)
objp
->
SetValue
(
G
,
new
(
G
)
JVALUE
(
jsp
),
Nodes
[
Nod
-
2
].
Key
);
objp
->
Set
Key
Value
(
G
,
new
(
G
)
JVALUE
(
jsp
),
Nodes
[
Nod
-
2
].
Key
);
}
else
if
(
jvp
)
jvp
->
SetValue
(
jsp
);
...
...
@@ -2032,14 +2032,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
case
TYPE_DOUBLE
:
if
(
arp
)
{
if
(
Nodes
[
Nod
-
1
].
Op
==
OP_EQ
)
arp
->
SetValue
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
),
Nodes
[
Nod
-
1
].
Rank
);
arp
->
Set
Array
Value
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
),
Nodes
[
Nod
-
1
].
Rank
);
else
arp
->
AddValue
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
));
arp
->
Add
Array
Value
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
));
arp
->
InitArray
(
G
);
}
else
if
(
objp
)
{
if
(
Nodes
[
Nod
-
1
].
Key
)
objp
->
SetValue
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
),
Nodes
[
Nod
-
1
].
Key
);
objp
->
Set
Key
Value
(
G
,
new
(
G
)
JVALUE
(
G
,
Value
),
Nodes
[
Nod
-
1
].
Key
);
}
else
if
(
jvp
)
jvp
->
SetValue
(
g
,
Value
);
...
...
@@ -2189,7 +2189,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
key
=
p
;
objp
=
jsp
->
GetObject
();
arp
=
NULL
;
val
=
objp
->
GetValue
(
key
);
val
=
objp
->
Get
Key
Value
(
key
);
if
(
!
val
||
!
(
jsp
=
val
->
GetJson
()))
{
sprintf
(
g
->
Message
,
"Cannot find object key %s"
,
key
);
...
...
@@ -2215,7 +2215,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
arp
=
jsp
->
GetArray
();
objp
=
NULL
;
i
=
atoi
(
p
)
-
B
;
val
=
arp
->
GetValue
(
i
);
val
=
arp
->
Get
Array
Value
(
i
);
if
(
!
val
)
{
sprintf
(
g
->
Message
,
"Cannot find array value %d"
,
i
);
...
...
@@ -2236,17 +2236,17 @@ int TDBJSON::MakeDocument(PGLOBAL g)
Doc
=
new
(
g
)
JARRAY
;
if
(
val
)
{
Doc
->
AddValue
(
g
,
val
);
Doc
->
Add
Array
Value
(
g
,
val
);
Doc
->
InitArray
(
g
);
}
else
if
(
jsp
)
{
Doc
->
AddValue
(
g
,
new
(
g
)
JVALUE
(
jsp
));
Doc
->
Add
Array
Value
(
g
,
new
(
g
)
JVALUE
(
jsp
));
Doc
->
InitArray
(
g
);
}
// endif val
if
(
objp
)
objp
->
SetValue
(
g
,
new
(
g
)
JVALUE
(
Doc
),
key
);
objp
->
Set
Key
Value
(
g
,
new
(
g
)
JVALUE
(
Doc
),
key
);
else
if
(
arp
)
arp
->
SetValue
(
g
,
new
(
g
)
JVALUE
(
Doc
),
i
);
arp
->
Set
Array
Value
(
g
,
new
(
g
)
JVALUE
(
Doc
),
i
);
else
Top
=
Doc
;
...
...
@@ -2409,7 +2409,7 @@ int TDBJSON::ReadDB(PGLOBAL)
M
++
;
rc
=
RC_OK
;
}
else
if
(
++
Fpos
<
(
signed
)
Doc
->
size
())
{
Row
=
Doc
->
GetValue
(
Fpos
);
Row
=
Doc
->
Get
Array
Value
(
Fpos
);
if
(
Row
->
GetType
()
==
TYPE_JVAL
)
Row
=
((
PJVAL
)
Row
)
->
GetJson
();
...
...
@@ -2432,25 +2432,25 @@ int TDBJSON::WriteDB(PGLOBAL g)
PJVAL
vp
=
new
(
g
)
JVALUE
(
Row
);
if
(
Mode
==
MODE_INSERT
)
{
Doc
->
AddValue
(
g
,
vp
);
Doc
->
Add
Array
Value
(
g
,
vp
);
Row
=
new
(
g
)
JOBJECT
;
}
else
if
(
Doc
->
SetValue
(
g
,
vp
,
Fpos
))
}
else
if
(
Doc
->
Set
Array
Value
(
g
,
vp
,
Fpos
))
return
RC_FX
;
}
else
if
(
Jmode
==
MODE_ARRAY
)
{
PJVAL
vp
=
new
(
g
)
JVALUE
(
Row
);
if
(
Mode
==
MODE_INSERT
)
{
Doc
->
AddValue
(
g
,
vp
);
Doc
->
Add
Array
Value
(
g
,
vp
);
Row
=
new
(
g
)
JARRAY
;
}
else
if
(
Doc
->
SetValue
(
g
,
vp
,
Fpos
))
}
else
if
(
Doc
->
Set
Array
Value
(
g
,
vp
,
Fpos
))
return
RC_FX
;
}
else
{
// if (Jmode == MODE_VALUE)
if
(
Mode
==
MODE_INSERT
)
{
Doc
->
AddValue
(
g
,
(
PJVAL
)
Row
);
Doc
->
Add
Array
Value
(
g
,
(
PJVAL
)
Row
);
Row
=
new
(
g
)
JVALUE
;
}
else
if
(
Doc
->
SetValue
(
g
,
(
PJVAL
)
Row
,
Fpos
))
}
else
if
(
Doc
->
Set
Array
Value
(
g
,
(
PJVAL
)
Row
,
Fpos
))
return
RC_FX
;
}
// endif Jmode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment