Miva Script index types ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Emma
    Mivite

    • Mar 2006
    • 230

    #1

    Miva Script index types ?

    Hello everyone,

    I'm working on a project where I have to find out the type of an index file (.mvx) when we are not the author of the database (just scan and parse the header of the mvx file)... I have the "expression" of the index, but now, my last challenge is to find if it's unique, non unique, ascending or not...

    Does anyone succeded to do that? (Linux server, and I'm open to C programs too)

    A few words on my project... It's a MivaScript Framework (coded in mivascript) that will be free of charge (but not open source in a first time) and wich it will be able to do the exact tasks as PhpMyAdmin but with MivaScript. Also there will be a library that will give the possibility to code in the same way (same type of code) with any Database ( Dbf, Mysql, MivaSql).

    Thanks in adavance
    Claudiu
    Attached Files
    Last edited by Emma; 03-03-09, 06:28 AM.
    Zen Radio : Relax :) : www.zenradio.fm
    MivaScript Tutorials & Scripts : www.mivascript.org
  • virtualkiwi
    Mivite

    • Mar 2006
    • 136

    #2
    Re: Miva Script index types ?

    I don't know the answer, but interesting ... I can see where you're coming from. Sort of like <mvrevealstructure> for indexes? Maybe Miva should add a new tag <mvrevealindex>?
    Interesting project too. I've thought about something like that a few times. Actually got a fair way down the track with something like it for dbf files, but I know I should really be going SQL. Personally, I'd like to see something more like Microsoft Access than just PhpMyAdmin, ie create web forms with field placeholders and datasource etc, etc... Probably because when I'm not doing Mivascript I'm doing Access coding!
    Christopher Cookson
    Create IT Powered by Webpression CMS

    Comment

    • Kent Multer
      Mega Mivite









      • Mar 2006
      • 3252

      #3
      Re: Miva Script index types ?

      Miva's index format is proprietary. Maybe someone at MivaMerchant Corp. can provide the info.

      If I had to figure it out myself, I'd try creating a series of very small databases and indexes. For example, create two DB indexes that are identical, except one is ascending and the other is descending. Then study the files to see what's different; it might be a single bit somewhere near the start of the file. The other flags can probably be discovered the same way.

      Hope that helps --
      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

      • Emma
        Mivite

        • Mar 2006
        • 230

        #4
        Re: Miva Script index types ?

        Hi Christopher & Kent :)

        Indeed, that's what I tried, the first time. Comparing the different types of files, but I didn't get to find the necessary differences so I can get a clear result of it.

        I kind of abandoned (for the moment) the idea of getting the types of indexes. I'll let the users update the indexes types till I get a functional solution. Of course, creating the DB with my system will make that easier, because it will record the index types.

        I came with that project because I was sick to code every time same things. I know that most of the real MivaScript coders have already made theirs little systems of code generation (or database general functions). This system will not be really for them, but for the beginners and for those who don't have already theirs own fake "db classes" :)

        Another thing, is that I called that system MS-OS ( it comes from MivaScript-Objects System). I didn't wanted to create a trademark infringement, so I leave only the initials :) . If your question is why I put "Objects" in the title, is that I tried to create a fake Object Language Programming with my library. In a few words, the user will be able to create a web form only with a couple of lines and a DB created with the system. (all update, delete, add, etc... are managed by the system).
        That's not the only "objects" the system have. There are some nice tools like integrated ajax (I use jQuery), WYSIWYG editor, image objects (size, auto thumbs image generation, etc.. etc). I won't detail more, but it's kind of really handy for those who don't want to spare too much time coding MivaScript all day long :)

        I'll put detailed information for those who are interested when all my dev is over (I'm about 70% done)

        Thanks
        Claudiu
        Last edited by Emma; 03-05-09, 06:29 AM.
        Zen Radio : Relax :) : www.zenradio.fm
        MivaScript Tutorials & Scripts : www.mivascript.org

        Comment

        • burch
          Administrator

          • Mar 2009
          • 630

          #5
          Re: Miva Script index types ?

          Claudiu,

          First, your project looks very nice.

          The header of a MivaScript index is 427 bytes long, and contains a number of fields. Multi-byte numbers (WORD, DWORD) are stored in little-endian format.

          Here's the offset definitions from our source:

          Code:
          #define HTSI_IDENTIFIER_OFFSET          0
          #define HTSI_VERSION_OFFSET             4
          #define HTSI_UPDATECOUNT_OFFSET         5
          #define HTSI_NUMPAGES_OFFSET            9
          #define HTSI_STARTINGPAGE_OFFSET        13
          #define HTSI_ORDER_OFFSET               17
          #define HTSI_PAGESIZE_OFFSET            19
          #define HTSI_KEYRECORDSIZE_OFFSET       21
          #define HTSI_FLAGS_OFFSET               23
          #define HTSI_KEYEXPRESSION_OFFSET       27
          (The age of this code should be apparent from the fact that the identifiers start with HTSI, for HtmlScript).

          Most of the values were originally intended for forward compatibility should we change details of the index implementation (order, pagesize, etc...), and the values will always be the same.

          The field you're interested in is flags. It's a DWORD bitfield, and the values are as follows:

          Code:
          #define HTSI_FLAG_UNIQUE                0x01
          #define HTSI_FLAG_DESCENDING            0x02
          #define HTSI_FLAG_FORCESTRING           0x04
          #define HTSI_FLAG_RANGE                 0x08
          A flags value of 0 indicates a nounique, ascending index.

          I've written an example function that reads a .mvx header and dumps it into a structure. It should be attached to this post.
          Attached Files

          Comment

          • Emma
            Mivite

            • Mar 2006
            • 230

            #6
            Re: Miva Script index types ?

            Hello Burch

            You made my day... I'm very grateful for your help... now I can add all the functionalities I wanted to implement. I didn't expected all that code ... I have nothing left to code :D

            Many thanks for your help an for your appreciation! I'll be back soon with a beta for all the persons that are interested in ;)

            Best regards,
            Claudiu
            Zen Radio : Relax :) : www.zenradio.fm
            MivaScript Tutorials & Scripts : www.mivascript.org

            Comment

            • Kent Multer
              Mega Mivite









              • Mar 2006
              • 3252

              #7
              Re: Miva Script index types ?

              Thanks Jon! It's great to see this kind of inside information being made available to developers.
              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