Convert to Varchar Problem

Beatrix Willius bwillius at gmx.de
Thu Jun 23 05:10:01 CDT 2011


Hi,

got another problem. In a new version of my application I'm converting some fields to VarChar. For one field a user sent me an error message:

2011-06-21, 16:38:37                             An error happened:
2011-06-21, 16:38:37                             Class/Method: getDatabase.ConvertToVarchar
2011-06-21, 16:38:37                             Time: Tuesday, 21 June 2011 16:38:37 27361688
2011-06-21, 16:38:37                             Type of Error: VException 144643 Attempt to insert duplicate key row in object "Mailbox.MailboxPath" with unique index "U_Mailbox_MailboxPath".
2011-06-21, 16:38:37                             --------------------------
2011-06-21, 16:38:37                             Stack:
2011-06-21, 16:38:37                             
Sub VField.IsUnique.Set( int32, boolean )
Sub getDatabase.ConvertToVarchar()
Function getDatabase.openDB( int32 ) as boolean
Function getDatabase.get( FolderItem, boolean, int32, VDatabase, boolean, AddMailboxDataInterface ) as VDatabase

The code is as follows:

  dim MailboxTable as VTable = ValentinaDB.Table("Mailbox")
  if MailboxTable <> nil then
    dim MailboxPath as VString = MailboxTable.StringField("MailboxPath")
    if MailboxPath <> nil then 
      dim newMailboxPath as VField = MailboxTable.ChangeType(MailboxPath, EVFieldType.kTypeText, 256)
      newMailboxPath.IsUnique = true
    end if
    
  end if

The old definition of the field MailboxPath is:

  dim MailboxPath as VString = new VString("MailboxPath",  1000)
  MailboxPath.IsUnique = true

Where could the error message come from? I can't reproduce this on my system. Haven't been able to see the database where the error occurs.

Mit freundlichen Grüßen/Regards

Trixi Willius

http://www.mothsoftware.com
Mail Archiver X: archive, clean and search email
http://www.beatrixwillius.de
Fractals, 3d landscapes etc.



More information about the Valentina mailing list