FreeTds 를 이용하여 이미지 파일을 mssql의 image Column에 넣
고수님의 조언으로 image타입의 데이터를 가져오는 것까지 성공하였습니다.
그런데 이번엔 그림 파일을 원격에 있는 mssql의 image 타입에 넣어줘야 하는데 또 만만치 않군요.
api에서는 dbwritetext(...)라는 함수를 써야 할듯한데... 잘안됩니다.
RETCODE dbwritetext ( DBPROCESS * dbproc,
char * objname,
DBBINARY * textptr,
DBTINYINT textptrlen,
DBBINARY * timestamp,
DBBOOL log,
DBINT size,
BYTE * text
)
Send text or image data to the server.
Parameters:
dbproc contains all information needed by db-lib to manage communications with the server.
objname table name
textptr text pointer to be modified, obtained from dbtxptr().
textptrlen Ignored. Supposed to be DBTXPLEN.
timestamp text timestamp to be modified, obtained from dbtxtimestamp() or dbtxtsnewval(), may be NULL.
log TRUE if the operation is to be recorded in the transaction log.
size overall size of the data (in total, not just for this call), in bytes. A guideline, must not overstate the case.
text the chunk of data to write.
Return values:
SUCCEED everything worked.
FAIL not sent, possibly because timestamp is invalid or was changed in the database since it was fetched.
See also:
dbmoretext(), dbtxptr(), dbtxtimestamp(), dbwritetext(), dbtxtsput().
이런 식으로 나와있는데... 적용을 전혀 못하겠네요. 특히나 dbtxptr(), dbtxtimestamp()함수는 계속 널이 나옵니다.
사용 경험이 있으신 고수님께서는 간단한 샘플 부탁드립니다.
api는 http://www.freetds.org/reference/a00336.html#a13 을 참고하였습니다.
댓글 달기