Announcement

Collapse
No announcement yet.

FREE: MySQL Action Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • FREE: MySQL Action Plugin

    MySQL Action Plugin



    This plugin is just to add functionality to AMS, I don't recommend using it in a program that will be publicly released.

    This plugin doesn't require LuaCOM as a dependency but it does use it. The plugin is around 300KB.

    Proof it works:



    Source is included in the ZIP.

    Find an example and the plugin attached to this post.

    Not related: I turned 14 on the 7th of September.

    IMPORTANT STUFF
    • The plugin requires the MySQL 3.51 ODBC Driver to be installed on the targets machine. (Download)
    • This is only recommended for private use. This plugin is not recommended for public applications.
    • COM exceptions are thrown on a MySQL syntax or server error. (Looks just like an AMS error dialog.)
    • Cake tastes nice.
    Attached Files
    Last edited by ShadowUK; 09-12-2009, 03:48 PM. Reason: spelling errors

  • #2
    Very nice you smart arss :yes

    Comment


    • #3
      Hah, I wonder if people would prefer it to output like tbData[1]["field name"] instead of tbData["field name"][1]..

      Comment


      • #4
        I used a littel bit of your code to do this

        you can converse to your stack streamed system

        PHP Code:
        function DB.Query(statement)
        ---------------------------------------------------
        ---------
        exec


          
        if statement == "%BEGIN" then
            dblua_data
        .connection:BeginTrans()
            return
          elseif 
        statement == "%COMMIT" then
            dblua_data
        .connection:CommitTrans()
            return
          elseif 
        statement == "%ROLLBACK" then
            dblua_data
        .connection:RollbackTrans()
            return
          
        end

          
        if dblua_data.recordset == nil then
            dblua_data
        .recordset luacom.CreateObject("ADODB.RecordSet")
          elseif 
        dblua_data.recordset.State ~= 0 then
            dblua_data
        .recordset:Close()
          
        end

          dblua_data
        .recordset:Open(statementdblua_data.connection)
          
        -----------------------------------------------------
        ----------
        row

          local row 
        = {}
          
        local fields dblua_data.recordset.Fields
          local i 
        0

          
        while fields.Count do
          
            
        local field fields:Item(i)
            
        row[i] = field.Value
            row
        [field.Name] = field.Value

            i 
        1
          end

          dblua_data
        .recordset:MoveNext()
          --
        dblua_data.recordset:MoveFirst()
          
        local t=row
        -----------------------------------------------------
        ret={Fields,Field={},Data={{},{}},Count}

        ret.Fields=dblua_data.recordset.Fields.count
        min 
        1
        max dblua_data.recordset.Fields.count
        for count minmax do
            
        ret.Field[count]=dblua_data.recordset.Fields:Item(count-1).Name
        end
        dblua_data
        .recordset:MoveFirst()
        local c=0
        while not (dblua_data.recordset.EOF) do
        c=c+1
        ret
        .Data[c]={}
                    for 
        0dblua_data.recordset.Fields.Count do
                        
        local Field dblua_data.recordset.Fields:Item(i);
                        
                        if 
        Field and Field.Value then
                            
        if not (ret.Data[c][Field.Name]) then
                                ret
        .Data[c][Field.Name] = {};
                                
        ret.Data[c][i+1]= {};
                            
        end
                            
                            ret
        .Data[c][Field.Name]=Field.Value
                            ret
        .Data[c][i+1]=Field.Value
                        end
                    end
                    
                    dblua_data
        .recordset:MoveNext();
                
        end
        ret
        .Count=c
        return ret
        end 
        This returns the complete table including fields count and names, and test if recordset is working

        Comment


        • #5
          tData[i][field] would be nice shadow, but this is a briliant plugin, well done :yes

          Oh, happy birthday (Can i have some cake too? ^^)
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            As an alternative, you can find a native MySQL plugin on my site. It does not use LuaCOM or ODBC drivers - the MySQL client library is statically linked to the plugin. The plugin works with AutoPlay Media Studio, Setup Factory, TrueUpdate and Visual Patch.



            Ulrich

            Comment


            • #7
              Shameless thread plug.

              Comment


              • #8
                Instead of opening a new thread and scatter the information in the forum, I think it makes more sense keeping related information together. After all, this is not a competition, and we are just offering two different solutions for the same problem.

                Ulrich

                Comment


                • #9
                  Ah, fair enough.

                  Mine has the advantage of being free but the disadvantage of using LuaCOM and ODBC.

                  Yours has the advantage of having more functionality and no need for odbc but the disadvantage of having to pay.

                  Comment


                  • #10
                    You're talking serious? On first, there aren't any disadvantage in ue odbc, most of windows programs uses to operate databases, but the plugin by ulrich is an probed and effective solution, if you use AMS to enjoy, I know that 30-days of use is a seriuous catch, but when you use in professional applications a tool effective and probed is relly needed, and the super-high-low cost of this (more unexpensive than a shirt) makes a good effect.

                    I purchased his products and are perfect and helps me in my work.

                    Comment


                    • #11
                      Originally posted by ShadowUK View Post
                      Ah, fair enough.

                      Mine has the advantage of being free but the disadvantage of using LuaCOM and ODBC.

                      Yours has the advantage of having more functionality and no need for odbc but the disadvantage of having to pay.
                      It's free http://www.mindquake.com.br/ams.php#plugins
                      Dermot

                      I am so out of here :yes

                      Comment


                      • #12
                        Originally posted by pabloko View Post
                        You're talking serious? On first, there aren't any disadvantage in ue odbc, most of windows programs uses to operate databases, but the plugin by ulrich is an probed and effective solution, if you use AMS to enjoy, I know that 30-days of use is a seriuous catch, but when you use in professional applications a tool effective and probed is relly needed, and the super-high-low cost of this (more unexpensive than a shirt) makes a good effect.

                        I purchased his products and are perfect and helps me in my work.
                        Cutting out 2 layers (ADO & ODBC) is very good. It will be faster. Plus if you are distributing your app, very few people will have the MySQL ODBC driver installed, so you could not rely on it.

                        ODBC is great when you have no native way of working with the database.
                        Dermot

                        I am so out of here :yes

                        Comment


                        • #13
                          Originally posted by Dermot View Post
                          When i use this one to INSERT IGNORE INTO it does it but crashers the app on windows 7 is there any reason why?
                          it does do the action but crahers without and luck in using it again until reopened.

                          Comment


                          • #14
                            Thanks for the notice, please update the plugin with the current installer.

                            It is almost certain that I'll implement a few additional functions in the plugin, if the IR support desk remains as quiet as it was these days, so check for a possible update in the next couple of days.

                            Ulrich

                            Comment


                            • #15
                              Originally posted by Ulrich View Post
                              Thanks for the notice, please update the plugin with the current installer.

                              It is almost certain that I'll implement a few additional functions in the plugin, if the IR support desk remains as quiet as it was these days, so check for a possible update in the next couple of days.

                              Ulrich
                              Thanks i test this now.

                              Comment

                              Working...
                              X