Jump to content
Sign in to follow this  
cdkid

Number of @errors

Recommended Posts

cdkid

So I'm working on my MySQL udfs as you may or may not know. Revamping it and getting ready to submit to the devs for inclusion, and I was wondering what everyone thought a good way to do error returns would be. In my connect function it's got 7 params, 3 optional. I didn't think it'd be too neat to have seven different @error values (just for verifying all the params are valid!) Was wondering if anyone had a more... elegant solution?

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites
PsaltyDS

So I'm working on my MySQL udfs as you may or may not know. Revamping it and getting ready to submit to the devs for inclusion, and I was wondering what everyone thought a good way to do error returns would be. In my connect function it's got 7 params, 3 optional. I didn't think it'd be too neat to have seven different @error values (just for verifying all the params are valid!) Was wondering if anyone had a more... elegant solution?

~cdkid

My preference is for use of both @error and @extended, i.e. @error = 1 for all parameter errors with @extended = bad parameter number:

Func _MySQL_Function($Param1, $Param2, $Param3, $Param4, $Param5 = 0, $Param6 = "C:\Temp\Test.db", $Param7 = "connect")
    If $Param1 = "" Then Return SetError(1, 1, 0)
    ;...
    If Not FileExists($Param6) Then Return SetError(1, 6, 0)
    ;...
EndFunc   ;==>_MySQL_Function

Thanks for going to the effort of improving your UDFs!

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
cdkid

Thanks Psalty, never thought of that. Should be a bit more convenient than 8 possible @error returns :).

~cdkid


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×