Announcement

Collapse
No announcement yet.

Looking for documentation on how to read a Miva database via Miva Script

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

    Looking for documentation on how to read a Miva database via Miva Script

    Hello forum:
    Document http://www.mivascript.com/topic/databases.html section: "databases/MySQL" contains nothing but the comment "coming soon".
    Looking for somewhere where I can find documentation for reading a Miva database table with MivaScript.
    Thanks, Larry
    Larry
    Luce Kanun Web Design
    www.facebook.com/wajake41
    www.plus.google.com/116415026668025242914/posts?hl=en



    #2
    Re: Looking for documentation on how to read a Miva database via Miva Script

    In a nutshell, you use MvOPENVIEW for reading, and MvQUERY for writing ... What, specifically, do you want to do? The LSK may have some helpful examples.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Re: Looking for documentation on how to read a Miva database via Miva Script

      Are there any training materials on Miva script. Just wanting to get my feet wet.
      Larry
      Luce Kanun Web Design
      www.facebook.com/wajake41
      www.plus.google.com/116415026668025242914/posts?hl=en


      Comment


        #4
        Re: Looking for documentation on how to read a Miva database via Miva Script

        Well, I see that my book (see my sig) is available on Amazon, new or used, at some very low prices. It's pretty out of date, but of course the fundamentals of the language haven't changed much; and it does contain a number of useful sample scripts.
        Kent Multer
        Magic Metal Productions
        http://TheMagicM.com
        * Web developer/designer
        * E-commerce and Miva
        * Author, The Official Miva Web Scripting Book -- available on-line:
        http://www.amazon.com/exec/obidos/IS...icmetalproducA

        Comment


          #5
          Re: Looking for documentation on how to read a Miva database via Miva Script

          http://www.miva.com/videos/category/...veloper-series
          http://www.mivascript.com/item/mivas...vOPENVIEW.html
          http://www.mivascript.com/item/mivas...s/MvQUERY.html
          http://www.miva.com/support/downloads
          http://www.miva.com/docs

          Comment


            #6
            Re: Looking for documentation on how to read a Miva database via Miva Script

            Hi Kent:
            I purchased your book about 4 years ago, found it helpful then.
            Last edited by wajake41; 06-03-15, 11:08 AM.
            Larry
            Luce Kanun Web Design
            www.facebook.com/wajake41
            www.plus.google.com/116415026668025242914/posts?hl=en


            Comment


              #7
              Re: Looking for documentation on how to read a Miva database via Miva Script

              Ok, so I've installed the Miva Script compiler on my computer. Couldn't find any documentation on how to execute it. Any help would be greatly appreciated.
              Also I cannot find the directory when it was installed,
              Thanks, Larry
              Larry
              Luce Kanun Web Design
              www.facebook.com/wajake41
              www.plus.google.com/116415026668025242914/posts?hl=en


              Comment


                #8
                Re: Looking for documentation on how to read a Miva database via Miva Script

                You run it from a command line prompt, usually as an IDE call from the editor you use for scripting.
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                  #9
                  Re: Looking for documentation on how to read a Miva database via Miva Script

                  I've forgotten everything I ever knew about DOS, am relearning.
                  I'm playing with the Miva example cube in the install:
                  guessing at the proper format for mvc.exe in the C:MSC\bin directory I tried: mvc.exe c:\MSC\EXAMPLES\cube\cube.mv
                  Nothing seemed to happen. At least I didn't get an error
                  Is there any documentation on the commands that mvc.exe uses?
                  Thanks, Larry
                  Larry
                  Luce Kanun Web Design
                  www.facebook.com/wajake41
                  www.plus.google.com/116415026668025242914/posts?hl=en


                  Comment


                    #10
                    Re: Looking for documentation on how to read a Miva database via Miva Script

                    Looked in the cube directory and found "cube.mvc" WOW. pretty kool!
                    How do I add it to my website page? Usual insytall of a .mvc module process?
                    And how do I create a token for it?
                    Cheers, Larry
                    Larry
                    Luce Kanun Web Design
                    www.facebook.com/wajake41
                    www.plus.google.com/116415026668025242914/posts?hl=en


                    Comment


                      #11
                      Re: Looking for documentation on how to read a Miva database via Miva Script

                      you don't need the .exe extension. You won't get an error if it works, you just end up with a cube.mvc file in that directory (delete the old one first).

                      the only command extension i use is -C for 'compiler level'. Currently we use -C 5.20 which compiles to the 5.20 empressa engine.
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                        #12
                        Re: Looking for documentation on how to read a Miva database via Miva Script

                        My program is compiling OK but when I run it using a URL I'm not getting a result, even when I use an invalid user ID and password.

                        This is my code adapted from an example. So what am I doing wrong! Tell me the ways.
                        MvFUNCTION NAME = "getzone" PARAMETERS = "zip var" STANDARDOUTPUTLEVEL = "" ERROROUTPUTLEVEL = "">
                        <mvopen
                        NAME="zones"
                        DATABASE="devpark_mm5"
                        TYPE="MYSQL"
                        username="username"
                        password="password">
                        <mvcomment> hardcoded zip for testing </mvcomment>
                        <MvASSIGN NAME = "l.zip" VALUE = "{ 015 }">
                        <MvASSIGN NAME = "l.zone" VALUE = "{ 'not found' }">
                        <MvOPENVIEW NAME = "dbview"
                        VIEW = "result"
                        QUERY="{ 'SELECT * FROM zones where ' $l.zip $ ' >= ' $lowzip $' AND ' $l.zip $' <=' $hizip }">
                        <MvIF EXPR = "{ g.MvOPENVIEW_Error }">
                        <MvFUNCTIONRETURN VALUE = "{ [ g.Module_Library_Utilities ].Error( 'MER-FFL-CST-00002', g.MvOPENVIEW_Error ) }">
                        </MvIF>
                        <MvASSIGN NAME = "l.zone" VALUE = "{ result.d.zone }">
                        <MvCLOSEVIEW NAME = "dbview" VIEW = "zone">
                        <MvFUNCTIONRETURN VALUE = "{ l.zone }">
                        </MvFUNCTION>

                        I'm guessing that the l.zone variable would be available to my program after this function is executed?

                        I was thinking I would call this with the toolkit's callURL but I now think that's probably not the correct way to execute it. How should it be executed?

                        Thanks, Larry
                        Last edited by wajake41; 06-04-15, 10:04 PM.
                        Larry
                        Luce Kanun Web Design
                        www.facebook.com/wajake41
                        www.plus.google.com/116415026668025242914/posts?hl=en


                        Comment


                          #13
                          Re: Looking for documentation on how to read a Miva database via Miva Script

                          If you MvOPEN the DB with NAME="zones," then you have to use NAME="zones" for MvOPENVIEW as well. The above code should get an MvOPENVIEW error, but maybe you're not seeing the message? You may not be aware that the Error() utility function doesn't actually display an error message; it just sets up some global variables.

                          I don't recommend setting ERROROUTPUTLEVEL to null, especially during debugging. If something goes wrong, I prefer to know about it right away.

                          The usual way to call a function like this would be with MvDO, although that depends on how you use the function and what you want to do with the results.

                          HTH --
                          Last edited by Kent Multer; 06-05-15, 05:09 AM.
                          Kent Multer
                          Magic Metal Productions
                          http://TheMagicM.com
                          * Web developer/designer
                          * E-commerce and Miva
                          * Author, The Official Miva Web Scripting Book -- available on-line:
                          http://www.amazon.com/exec/obidos/IS...icmetalproducA

                          Comment


                            #14
                            Re: Looking for documentation on how to read a Miva database via Miva Script

                            Hi Kent:
                            Made the change you suggested. My mvopenview code looks like this now:
                            <MvOPENVIEW NAME = "zones"
                            VIEW = "result"
                            QUERY="{ 'SELECT * FROM zones where ' $l.zip $ ' >= ' $lowzip $' AND ' $l.zip $' <=' $hizip }">
                            <MvIF EXPR = "{ g.MvOPENVIEW_Error }">
                            <MvFUNCTIONRETURN VALUE = "{ g.zone }">
                            <mvcomment> <MvFUNCTIONRETURN VALUE = "{ [ g.Module_Library_Utilities ].Error( 'MER-FFL-CST-00002', g.MvOPENVIEW_Error ) }"> </mvcomment>
                            </MvIF>
                            <MvASSIGN NAME = "g.zone" VALUE = "{ result.d.zone }">
                            <MvCLOSEVIEW NAME = "zones" VIEW = "zone">
                            <MvFUNCTIONRETURN VALUE = "{ g.zone }">


                            In my template I'm using MvDO like this:
                            <MvDO FILE="/zone1.mvc" NAME="getZone" >
                            xx &mvt:global:zone;

                            file zone1.mvc is in my mm5 directory and the function name is "getZone"
                            Still getting nothing back in &mvt:global:zone; and no error message.

                            Larry's getting frustrated!
                            Last edited by wajake41; 06-05-15, 06:50 AM.
                            Larry
                            Luce Kanun Web Design
                            www.facebook.com/wajake41
                            www.plus.google.com/116415026668025242914/posts?hl=en


                            Comment


                              #15
                              Re: Looking for documentation on how to read a Miva database via Miva Script

                              Hmmm, there still seem to be some problems in this code. Before you use MvOPENVIEW, you have to use MvOPEN, unless this is for a module, in which case the database is already MvOPENEDed with the name "Merchant." Usually MvOPEN is called once in a script, to establish the connection to the DB. After that, you use MvOPENVIEWs for each SELECT, and MvQUERYs for each insert/update/delete.

                              Your MvIF block for the OPENVIEW error returns the value of g.zone, which is null, unless you've already assigned some value to it. You commented out the call to Error(), but I'd recommend replacing that with something simple and reliable like:

                              <MvEVAL EXPR="{ 'ERROR: couldn\'t open database view, ' $ g.MvOPENVIEW_Error $ '<br/>' }">
                              <MvFUNCRETURN VALUE="0">

                              Also, I'm not sure what's up with the variable l.zip in the OPENVIEW. Unless it contains a column name, that won't work. If there's a column in the table named zip," you can write that part as:

                              QUERY="{ 'SELECT * FROM zones where zip >= ' $ lowzip $ ' AND zip <=' $ hizip }">

                              HTH --
                              Kent Multer
                              Magic Metal Productions
                              http://TheMagicM.com
                              * Web developer/designer
                              * E-commerce and Miva
                              * Author, The Official Miva Web Scripting Book -- available on-line:
                              http://www.amazon.com/exec/obidos/IS...icmetalproducA

                              Comment

                              Working...
                              X