2010-10-24 02:21 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)

* harbour/rtl/hbjson.c
    + added support for date and timestamp type encoding
This commit is contained in:
Mindaugas Kavaliauskas
2010-10-22 23:23:19 +00:00
parent c7c5d14460
commit 8d19033374
2 changed files with 21 additions and 0 deletions

View File

@@ -16,6 +16,10 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-10-24 02:21 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/rtl/hbjson.c
+ added support for date and timestamp type encoding
2010-10-24 02:10 UTC+0300 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/rtl/hbjson.c
+ added human readable JSON encoding support

View File

@@ -262,6 +262,23 @@ static void _hb_jsonEncode( PHB_ITEM pValue, PHB_JSON_ENCODE_CTX pCtx, HB_SIZE n
_hb_jsonCtxAdd( pCtx, "false", 5 );
}
else if( HB_IS_DATE( pValue ) )
{
char szBuffer[ 10 ];
hb_itemGetDS( pValue, szBuffer + 1 );
szBuffer[ 0 ] = '\"';
szBuffer[ 9 ] = '\"';
_hb_jsonCtxAdd( pCtx, szBuffer, 10 );
}
else if( HB_IS_TIMESTAMP( pValue ) )
{
char szBuffer[ 19 ];
hb_itemGetTS( pValue, szBuffer + 1 );
szBuffer[ 0 ] = '\"';
szBuffer[ 18 ] = '\"';
_hb_jsonCtxAdd( pCtx, szBuffer, 19 );
}
else if( HB_IS_ARRAY( pValue ) )
{
HB_SIZE nLen = hb_itemSize( pValue );