View Issue Details

IDProjectCategoryView StatusLast Update
0008739ADK-Xojo-V4RBSQLpublic2020-09-24 07:22
ReporterBeatrix Willius Assigned ToIvan Smahin  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version10.0.x 
Summary0008739: VPreparedStatement gives wrong result if one parameter has empty string
DescriptionTry the attached example. I'm doing direct SQL and a VPreparedStatement. Both should give the same result. If username is an empty string the results are different. The code works fine if username is not an empty string.

dim username as String = ""
dim mailbox as String = "Trash"

dim MailboxSQL1 as String = "select RecID, * from Mailbox where lower(MailboxPath) = lower('" + Mailbox + "') and username = ''"
dim MailboxCursor1 as VCursor = mDatabase.SqlSelect(MailboxSQL1, EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
dim RecordCount1 as Integer = MailboxCursor1.RecordCount

dim MailboxSQL2 as String = "select RecID, * from Mailbox where lower(MailboxPath) = lower(?) and username = ?"
dim MailboxPrepared as VPreparedStatement = mDatabase.Prepare(MailboxSQL2)
MailboxPrepared.BindText(0, mailbox)
MailboxPrepared.BindText(1, Username)
dim MailboxCursor2 as VCursor = MailboxPrepared.SqlSelect(EVCursorLocation.kServerSide, EVLockType.kNoLocks, EVCursorDirection.kRandom)
dim RecordCount2 as Integer = MailboxCursor2.RecordCount

if RecordCount1 <> RecordCount2 then
  MsgBox "error"
end if

Using latest Valentina with Xojo 2019r3 and High Sierra.
TagsNo tags attached.

Activities

Beatrix Willius

Beatrix Willius

2020-02-27 10:39

reporter  

Archive.zip (32,095 bytes)

Issue History

Date Modified Username Field Change
2020-02-27 10:39 Beatrix Willius New Issue
2020-02-27 10:39 Beatrix Willius File Added: Archive.zip
2020-02-28 07:53 Ivan Smahin Assigned To => Ivan Smahin
2020-02-28 07:53 Ivan Smahin Status new => resolved
2020-02-28 07:53 Ivan Smahin Resolution open => fixed
2020-02-28 07:53 Ivan Smahin Fixed in Version => 10.0.x