Results 1 to 10 of 35

Thread: ADODB Question

Share/Bookmark

Hybrid View

  1. #1

    ADODB Question

    Hi,

    at the moment I am testing the ADODB functionality and for me it works great.
    My question is what is the best way to check if a insert, update or delete operation
    is error-free?

    Thanks for your support.

    Axel

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,115
    Blog Entries
    2
    Rep Power
    10
    Ciao Axel,

    that area is still to be implemented.
    I also use a lot ADODB at work and I too need error checking. So I will start to check about it.

    Eros

    PS: mask edit is still on the table, sorry.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3
    Ciao Eros,

    sounds good
    Thank you for the fast answer.

    Axel

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,115
    Blog Entries
    2
    Rep Power
    10
    I think I will have a solution in few days that I can post here to test.

    Actually I'm facing the problem that every single ADODB operation can fire an error but I'm only able to catch the last one.
    So, if an operation composed by 3 steps fails at first or second step but third is OK, I get no error.

    An example, the following code taken from \thinBasic\SampleScripts\ADODB\ example is composed by 4 pRecordset calls (record count plus 3 field data retrieve).
    If error occurs in one of the first 3 calls but the 4th is ok, I get no error.
           PrintL _
                  lRecCount,
                  pRecordSet.RecordCount, 
                  pRecordset.CollectS("ISBN"), 
                  pRecordset.CollectN("Year Published"), 
                  pRecordset.CollectS("Title")
    
    I can store errors as an array of errors but it would be complex to handled them.
    Anyway, thinking. Maybe I will just release catching last error and then I will refine it in some way.

    Ideal would be to have TRY/CATCH in thinBasic but so far I found implementing it quite difficult considering the interpretative nature of thinBasic.

    Will see.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    50
    Posts
    8,115
    Blog Entries
    2
    Rep Power
    10
    Dear Axel,

    I've developed something that can be a start.
    I've modified all internal ADODB functionality in such a way to intercept errors at any level.
    All errors are stored into an internal Module repository in such a way programmer can check and decide what to do.

    Mainly I've developed 3 functions:
    1. AdoDb_Errors_Count: will return number of errors so far intercepted
    2. AdoDb_Errors_Clear: will clear internal errors repository. Can be called whenever programmer wants to reset situation
    3. AdoDb_Errors_GetCode(Idx): will return error code in Idx position with Idx between 1 and AdoDb_Errors_Count
    4. AdoDb_Errors_GetDescription(Idx): will return error description in Idx position with Idx between 1 and AdoDb_Errors_Count


    An example on how to use:
      '---Do whatever with ADODB ... then check if some error.
      printl "-----"
        printl "Errors found:", AdoDb_Errors_Count
        if AdoDb_Errors_Count then
          for lError = 1 to AdoDb_Errors_Count
            printl AdoDb_Errors_GetCode(lError), AdoDb_Errors_GetDescription(lError)
          next
        end if
      printl "-----"
      AdoDb_Errors_Clear
    
    Attached an updated thinBasic_AdoDB module to put into \thinBasic\Lib\ substituting your current one.

    As I said, this is just a start in order to have something.
    I will see If I can develop something that react as an event.

    Let me know if it works.

    Ciao
    Eros
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #6
    Dear Eros,

    sounds fantastic!!!!!

    I'll test it asap and give you a feedback.

    Many thanks

    Axel

Similar Threads

  1. Question of the day ;)
    By Petr Schreiber in forum thinBasic General
    Replies: 8
    Last Post: 23-08-2010, 19:58
  2. C to TB question
    By Michael Clease in forum Other languages
    Replies: 2
    Last Post: 03-06-2010, 12:11
  3. gdi question
    By Lionheart008 in forum UI (User Interface)
    Replies: 6
    Last Post: 07-12-2009, 19:31
  4. UDT question
    By sandyrepope in forum thinBasic General
    Replies: 3
    Last Post: 18-02-2008, 22:33
  5. m15 question
    By kryton9 in forum M15 file format
    Replies: 4
    Last Post: 20-06-2007, 20:18

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •