Deciphering warnings

Karl Grob kgrob at mus.ch
Wed Oct 14 02:53:24 CDT 2009


> Sounds like some code try access your object before it is created.

For the moment I do not agree (but maybe I am blind):

I have the following code and everything in it exists:

   DIM cmd as string
   DIM ret as Integer

   cmd = "CREATE FUNCTION NextID_" + tblName + "()"
   cmd = cmd + " RETURNS ULONG "
   cmd = cmd + " BEGIN"
   cmd = cmd + " DECLARE max_autoid ULONG ;"

   cmd = cmd + " SET max_autoid ="
   cmd = cmd + " SELECT fldLetzterWert"
   cmd = cmd + " FROM tblMaximalwerte"
   cmd = cmd + " WHERE  fldTabellenname = '" + tblName + "' ;"

   cmd = cmd + " UPDATE tblMaximalwerte"
   cmd = cmd + " SET  fldLetzterWert = max_autoid + 1"
   cmd = cmd + " WHERE  fldTabellenname = '" + tblName + "' ;"

   cmd = cmd + " RETURN max_autoid + 1 ;"
   cmd = cmd + " END;"

   call myDB.SqlExecute( "SET PROPERTY WarningMode TO FALSE" ) ->  
without this Warning:  G e t   S P   :   N o   S P   w i t h   
 n a m e   'N e x t I D _ t b l Name'
   ret = myDB.SQLexecute(cmd)
   call myDB.SqlExecute( "SET PROPERTY WarningMode TO TRUE" )

The Table 'tblName' exists, 'tblMaximalwerte' exists and has values in  
it and everthing is flushed on disk.

It seems that creating Triggers does not give a warning, creating  
functions does.

I have another function, same kind of warning:

   DIM cmd as string
   DIM ret as Integer

   cmd = "CREATE FUNCTION holeWort( inValue ULONG, Pos BOOLEAN)"
   cmd = cmd + " RETURNS VARCHAR "
   cmd = cmd + " BEGIN"
   cmd = cmd + " DECLARE myString VARCHAR;"
   cmd = cmd + " SET myString = SELECT fldOriginalwort FROM  
tblWortliste JOIN tblWoerter WHERE tblWoerter.RecID = inValue;"
   cmd = cmd + " RETURN IF(Pos,INITCAP(myString),myString);"
   cmd = cmd + " END;"

   call myDB.SqlExecute( "SET PROPERTY WarningMode TO FALSE" )  ->  
without this Warning: Get SP : No SP with name holeWort
   ret = myDB.SQL_Execute(cmd)
   call myDB.SqlExecute( "SET PROPERTY WarningMode TO TRUE" )

Both functions do work properly.

Best Regards
Karl





More information about the Valentina mailing list