6 Replies Latest reply on Jan 13, 2007 8:11 AM by Newsgroup_User

    Database Functions

    SuperArtGuy
      I'm creating a little standalone program that needs to have database like functions. The program needs to store data fields like names, titles, etc. that can be modified/customized by the user. I've done this before in mySQL. But I don't want the user to have to go to a website or have a database loaded on their computer. I just want the fields to be stored in some type of document file that would be in the same folder as the program. Any suggestions?
        • 1. Re: Database Functions
          Level 7
          Forgive my ignorance, but I'm a little confused - You don't want to load
          a file on the user's computer or have them go to a web site, but you
          want the user to be able to modify/customize the data base? What other
          writable media will the user be using?

          Anyhoo, to do database operations with Director without using an
          external database engine like V12, you'll need to use property lists.
          The manual does a pretty good job of explaining how it's done. I've
          done several that way, so if you decide that's the way you want to go
          and run into problems/questions, post your questions and I'm sure there
          are several of us here who can get you going.

          SuperArtGuy wrote:
          > I'm creating a little standalone program that needs to have database like
          > functions. The program needs to store data fields like names, titles, etc. that
          > can be modified/customized by the user. I've done this before in mySQL. But I
          > don't want the user to have to go to a website or have a database loaded on
          > their computer. I just want the fields to be stored in some type of document
          > file that would be in the same folder as the program. Any suggestions?
          >
          • 2. Re: Database Functions
            SuperArtGuy Level 1
            Sorry if i'm being confusing. I'm developing a little program that needs to store some data like names, etc. I also want the data file that holds the information to be protected so that no one can open it up and change it without going through the projector program.
            • 3. Re: Database Functions
              Level 7
              The way I have done this in the past is to use property lists to set up
              the "database". Something like this:

              --instantiate the global
              global gDatabase
              gDatabase=[:]

              --create a list for each "table" inthe database
              mike=[#name:"Mike",#address:"mblaustein@gmail.com",#title:"Supreme Lingo
              Master"]
              dean=[#name:"Dean",#address:"d.utian@unsw.edu.au",#title:"Great and
              Powerful Oz"]
              superArtGuy=[#name:"Unknown",#address:"webforumUser@macromedia.com",#title:"Lingo
              learner"]

              --add the tables into the database
              gDatabase.setAProp(#mike,mike)
              gDatabase.setAProp(#dean,dean)
              gDatabase.setAProp(#SuperArtGuy,superArtGuy)

              OK. So now you have your database setup. To make things easy, in
              Director, go into the Object Inspector and enter in 'gDatabase' (without
              the quotes). Now you can go through the database and see all it's
              entries. To make changes, use Director's standard property list
              controllers (check out setAProp, addAProp, deleteProp).

              There are two ways to retrieve values using Lingo"

              1) Use getAProp:

              put getAProp(gDatabase[#mike],#address)
              -- "mblaustein@gmail.com"

              2) don't use getAProp:

              put gDatabase[#mike][#address]
              -- "mblaustein@gmail.com"

              Then, to save it to the hard drive, use the free vList xtra:

              http://www.updatestage.com/xtras/vlist.html

              This will save the list to a text file with optional encryption (so
              others cant open it and see your data). vList is super fast and easy to use.
              • 4. Re: Database Functions
                Level 7

                Mike Blaustein wrote:

                > --create a list for each "table" inthe database
                > dean=[#name:"Dean",#address:"d.utian@unsw.edu.au",#title:"Great and
                > Powerful Oz"]

                I like that data;)

                regards
                Dean

                Director Lecturer / Consultant
                http://www.fbe.unsw.edu.au/learning/director
                http://www.multimediacreative.com.au


                • 5. Re: Database Functions
                  Level 7
                  > Then, to save it to the hard drive, use the free vList xtra:
                  >
                  > http://www.updatestage.com/xtras/vlist.html
                  >
                  > This will save the list to a text file with optional encryption (so
                  > others cant open it and see your data). vList is super fast and easy to use.

                  vList Xtra isn't free though. It was sold by updatestage but is being moved to
                  Tabuleiro. See
                  http://www.updatestage.com/status_xtras.html

                  I've recently tried BuddyWeb Xtra which can also save lists to a file in an encrypted
                  format. It isn't free either:)
                  http://www.mods.com.au/frameset.htm

                  regards
                  Dean

                  Director Lecturer / Consultant
                  http://www.fbe.unsw.edu.au/learning/director
                  http://www.multimediacreative.com.au



                  • 6. Re: Database Functions
                    Level 7
                    In that case, you can use propSave which is free:

                    http://pimz.com/?id=xtras&section=propsave

                    Of course that one doesn't handle encryption, so you would have to use
                    BuddyAPI or something to encrypt the file (baEncryptText should do the
                    trick), and it is free as long as you use only 1 or 2 functions.

                    -Mike

                    Dean Utian wrote:
                    >> Then, to save it to the hard drive, use the free vList xtra:
                    >>
                    >> http://www.updatestage.com/xtras/vlist.html
                    >>
                    >> This will save the list to a text file with optional encryption (so
                    >> others cant open it and see your data). vList is super fast and easy to use.
                    >
                    > vList Xtra isn't free though. It was sold by updatestage but is being moved to
                    > Tabuleiro. See
                    > http://www.updatestage.com/status_xtras.html
                    >
                    > I've recently tried BuddyWeb Xtra which can also save lists to a file in an encrypted
                    > format. It isn't free either:)
                    > http://www.mods.com.au/frameset.htm
                    >
                    > regards
                    > Dean
                    >
                    > Director Lecturer / Consultant
                    > http://www.fbe.unsw.edu.au/learning/director
                    > http://www.multimediacreative.com.au
                    >
                    >
                    >