1. Beatrix Willius
  2. Valentina Database ADK
  3. Thursday, June 02 2022, 04:36 AM
  4.  Subscribe via email
Hi,

me with an odd problem again. A user updated a couple of databases from about 2 years ago. For each database he got an error after updating the database scheme:

2022-06-01 09:27:50 Message: Error in function name "PathSort"., Error Number: 591118, Stack: RuntimeRaiseException _Z23throwValentineExceptionjRKN3fbl6StringE _Z12ProceedErrorRN3fbl10xExceptionE _Z20Database_SqlSelect_1P16REALobjectStructP16REALstringStructiii VDatabase.SqlSelect%o<VCursor>%o<VDatabase>si8i8i8 VCursorController.Query%b%o<VCursorController> MainWindow.MainWindow.LoadData%%o<MainWindow.MainWindow> MainWindow.MainWindow.Event_Requery%%o<MainWindow.MainWindow>
2022-06-01 09:27:50 select RecID, MailboxPath, WhereClause, PathSort(MailboxPathNatSort) from mailbox order by 4
2022-06-01 09:27:50 Requery finished

The error only showed up directly after updating the database and then not again. A diagnosis said that the databases are okay.

The PathSort function is the basis of my database scheme:

try
'add function for proper sorting of mailbox paths
theSQL = "CREATE OR REPLACE"
theSql = theSql + " FUNCTION PathSort(thePath STRING) RETURNS STRING BEGIN CASE"
theSql = theSql + " WHEN LOWER(list_nthitem(thePath, 1, '" + globals.MailboxDivider + "')) = 'inbox' THEN RETURN concat('1:',"
theSql = theSql + " REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " WHEN LOWER(list_nthitem(thePath, 1, '" + globals.MailboxDivider + "')) = 'sent' THEN RETURN concat('2:',"
theSql = theSql + " REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " WHEN LOWER(list_nthitem(thePath, 1, '" + globals.MailboxDivider + "')) = 'sent messages' THEN RETURN"
theSql = theSql + " concat('2:', REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " WHEN thePath = 'Trash' THEN RETURN concat('7:', REPLACE(thePath, '" + globals.MailboxDivider + "',chr(10)));"
theSql = theSql + " WHEN thePath = 'Spam' THEN RETURN concat('3:', REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " WHEN LOWER(list_nthitem(thePath, 1, '" + globals.MailboxDivider + "')) = 'views' THEN RETURN concat('4:',REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " WHEN LOWER(list_nthitem(thePath, 1, '" + globals.MailboxDivider + "')) = 'Mailboxes' THEN RETURN concat('5:', REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " ELSE RETURN concat('6:', REPLACE(thePath, '" + globals.MailboxDivider + "', chr(10)));"
theSql = theSql + " END CASE END"
theError = ValentinaDB.SqlExecute(theSQL)
catch Err as VException
FinalError = theError
Globals.theErrorLog.LogItem "Error creating trigger: " + theSql
Globals.theErrorLog.LogItem "Error: " + str(Err.ErrorNumber)
end try


Any idea what might cause the error? Of course, I can't reproduce the behaviour myself.
Comment
There are no comments made yet.
Ivan Smahin Accepted Answer
Hi Beatrix,

So it happens only the first time after an upgrade and then works correctly?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 1
Ivan Smahin Accepted Answer
Following vKernel it can happen if VDatabase's have null pointer to vKernel's I_SqlDatabase.
But following to V4RB it is impossible.
Another possibility is "PathSort" is not registered in the database somehow.

Ok, most probably the database has some older db-format and we do some (set of) conversions to most new db format and somehow the function was missed to be registered.

Ok, can you send me that db (initial state - before any attempt to open)? It could be even some older db from that user - probably he has some backups
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 2
Beatrix Willius Accepted Answer
The databases are from 2-3 years ago. That makes the Valentina version about 9.5. The user is not very IT savvy. The databases ARE his backup and he doesn't have additional backups.

"PathSort" is set up correctly. Otherwise, my database wouldn't work at all. It's the central function of the database.

I'll ask the user if he has left any database that hasn't been converted.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Database ADK
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.