-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hbpgsql length timestamp field #236
Comments
Knowledge gathering: there is also Another wrapper we have https://github.com/harbour/core/blob/master/contrib/sddpg/core.c case TIMESTAMPOID:
dbFieldInfo.uiType = HB_FT_STRING;
dbFieldInfo.uiLen = 23;
break;
case TIMESTAMPTZOID:
dbFieldInfo.uiType = HB_FT_STRING;
dbFieldInfo.uiLen = 26;
break; It's a bit to low to represent them as strings, but if the date/time separators are stripped, it could fit. |
In harbour user list a user suggested to implement timestamp in hbpgsql: METHOD Refresh( lQuery, lMeta ) CLASS TPQquery
...
CASE "timestamp" $ cType
cType := "T" // "C"
nSize := 20
...
same in:
METHOD TableStruct( cTable ) CLASS TPQserver
in:
METHOD FieldGet( nField, nRow ) CLASS TPQquery
...
elseif cType == "T"
if ! ISNIL(result)
result:= strtran( result, "-", "" )
result:= strtran( result, ":", "" )
result:= strtran( result, " ", "" )
result := StoT( result )
else
IF !lReturnNil
result := StoT('')
ENDIF
end
in:
Static Function DataToSql(xField)
...
elseif cType == "T"
result := "'"+TRAN(ttos( xField),"@R 9999-99-99 99:99:99")+"'"
and:
Static Function ValueToString(xField)
elseif cType == "T"
IF !EMPTY(xField)
result := ttos( xField )
ENDIF
//-----------------
Function DtoQ(cData)
Return "'" + Str(Year(cData),4) + "-" + StrZero(Month(cData), 2) + "-" + StrZero(Day(cData), 2) + "'"
//------------------
Function StoQ(cData)
Return "'" + ALLTRIM(cData) + "'"
//------------------
Function TtoQ(cData)
Return "'" + Str(Year(cData),4) + "-" + StrZero(Month(cData), 2) + "-" + StrZero(Day(cData), 2) +;
' ' + HB_NTOS(HB_HOUR(cData)) + ':' + HB_NTOS(HB_MINUTE(cData)) + ':' + HB_NTOS(HB_SEC(cData)) + "'" its possible to implement this? |
In function tableStruct timestamp fields are converted in char with length 20, but sometimes the timestamp fields are filled with more char, ex: "2021-02-01 12:53:59.555394"
The text was updated successfully, but these errors were encountered: