int clip_COMPLEMENT(ClipMachine * ClipMachineMemory) { int len, dec; long d1, d2; int t = _clip_parinfo(ClipMachineMemory, 1); switch (t) { case LOGICAL_type_of_ClipVarType: _clip_retl(ClipMachineMemory, _clip_parl(ClipMachineMemory, 1)); break; case NUMERIC_type_of_ClipVarType: _clip_parp(ClipMachineMemory, 1, &len, &dec); _clip_retndp(ClipMachineMemory, 0.00 - _clip_parnd(ClipMachineMemory, 1), len, dec); break; case CHARACTER_type_of_ClipVarType: clip_CHARNOT(ClipMachineMemory); break; case DATE_type_of_ClipVarType: d1 = _clip_jdate(1, 1, 3000); d2 = _clip_pardj(ClipMachineMemory, 1); if (d2 == 0) _clip_retdj(ClipMachineMemory, d1); else _clip_retdj(ClipMachineMemory, d1 - d2 + _clip_jdate(7, 1, 0)); break; } return 0; }
int clip_DTOS(ClipMachine * ClipMachineMemory) { char *ret; long d = _clip_pardj(ClipMachineMemory, 1); ret = malloc(9); _clip_datetostr(d, ret); _clip_retcn_m(ClipMachineMemory, ret, 8); return 0; }
int clip_ODBC_OUT_DATE(ClipMachine* mp){ long julian = _clip_pardj(mp,1); short int s[3] = {0,0,0}; int yy,mm,dd,ww; if((_clip_parinfo(mp,1) == DATE_t) && julian){ _clip_cdate(julian,&dd,&mm,&yy,&ww); s[0] = yy; s[1] = mm; s[2] = dd; } _clip_retcn(mp,(char*)s,6); return 0; }
int clip_DAY(ClipMachine * ClipMachineMemory) { int dd, mm, yy, ww; if (_clip_pardj(ClipMachineMemory, 1) == 0) { _clip_retndp(ClipMachineMemory, 0, 3, 0); return 0; } _clip_pardc(ClipMachineMemory, 1, &yy, &mm, &dd, &ww); _clip_retndp(ClipMachineMemory, dd, 3, 0); return 0; }
int clip_PG_OUT_DATE(ClipMachine* mp){ PG_ROWSET* rowset = (PG_ROWSET*)_clip_fetch_c_item( mp,_clip_parni(mp,1),_C_ITEM_TYPE_SQL); long date = _clip_pardj(mp,2); int totext = _clip_parl(mp,3); if(!rowset){ _clip_trap_err(mp,0,0,0,subsys,ER_NOROWSET,er_norowset); return 1; } if((!totext)&&rowset->binary){ long d = date-2451545; _clip_retcn(mp,(char*)&d,4); } else { char str[11]; int y,m,d,w; _clip_cdate(date,&d,&m,&y,&w); snprintf(str,sizeof(str),"%04d-%02d-%02d",y,m,d); _clip_retc(mp,str); } return 0; }