I got very simple SQL to export some data:
dim theSQL as string = "select *, Recid from Attachment where MailID = " + Str(theMailID) + " and AttachmentName = '" + AttachmentNames(0) + "'"
dim theCursor as VCursor = theDatabase.SqlSelect(theSQL, EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
When testing the RecordCount of the cursor is 1. Everything is fine.
Then I want to use a VPreparedStatement instead and use:
dim theSQL as String = "select *, recid from Attachment where mailid = ? and AttachmentName = ?"
dim thePrepared as VPreparedStatement = theDatabase.Prepare(theSQL)
dim theCursor as VCursor = thePrepared.SqlSelect(EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
RecordCount of the cursor is 0. The SQL is so simple, but the prepared statements are impossible to debug. Then I thought: wait, Valentina is picky with encodings. And when checking the data in AttachmentNames(0) I saw that the encoding of the data was ASCII instead of UTF8. After defining the correct encoding everything works fine.
Bug or feature?