MCPcopy Create free account
hub / github.com/MariaDB/server / SerializeArray

Method SerializeArray

storage/connect/bson.cpp:669–708  ·  view source on GitHub ↗

/ Serialize a JSON Array. */ /

Source from the content-addressed store, hash-verified

667/* Serialize a JSON Array. */
668/***********************************************************************/
669bool BDOC::SerializeArray(OFFSET arp, bool b)
670{
671 bool first = true;
672 PBVAL vp = MVP(arp);
673
674 if (b) {
675 if (jp->Prty()) {
676 if (jp->WriteChr('['))
677 return true;
678 else if (jp->Prty() == 1 && (jp->WriteStr(EL) || jp->WriteChr('\t')))
679 return true;
680
681 } // endif Prty
682
683 } else if (jp->WriteChr('['))
684 return true;
685
686 for (; vp; vp = MVP(vp->Next)) {
687 if (first)
688 first = false;
689 else if ((!b || jp->Prty()) && jp->WriteChr(','))
690 return true;
691 else if (b) {
692 if (jp->Prty() < 2 && jp->WriteStr(EL))
693 return true;
694 else if (jp->Prty() == 1 && jp->WriteChr('\t'))
695 return true;
696
697 } // endif b
698
699 if (SerializeValue(vp))
700 return true;
701
702 } // endfor vp
703
704 if (b && jp->Prty() == 1 && jp->WriteStr(EL))
705 return true;
706
707 return ((!b || jp->Prty()) && jp->WriteChr(']'));
708} // end of SerializeArray
709
710/***********************************************************************/
711/* Serialize a JSON Object. */

Callers

nothing calls this directly

Calls 3

PrtyMethod · 0.80
WriteChrMethod · 0.80
WriteStrMethod · 0.80

Tested by

no test coverage detected