5 Replies Latest reply on Jan 2, 2009 10:41 AM by flexstone

    How to Copy SQLite Database to an Encrypted SQLite Databse ?

    manofspirit
      In page 236 of Air 1.5 Flex Documentation
      " If you have an existing database that’s not encrypted and you want to use database encryption, you can create a new encrypted database and copy the existing table structure and data to the new database."

      Could you please guide me how can i do that? (Copy existing table structure and data to the new database)
      Im just a newbie in AIR so i wd like to have a detailed reply.
      Thanks in advance buddies
        • 1. Re: How to Copy SQLite Database to an Encrypted SQLite Databse ?
          Level 7

          "manofspirit" <webforumsuser@macromedia.com> wrote in message
          news:girlgg$4vk$1@forums.macromedia.com...
          > In page 236 of Air 1.5 Flex Documentation
          > " If you have an existing database that?s not encrypted and you want to
          > use
          > database encryption, you can create a new encrypted database and copy the
          > existing table structure and data to the new database."
          >
          > Could you please guide me how can i do that? (Copy existing table
          > structure
          > and data to the new database)
          > Im just a newbie in AIR so i wd like to have a detailed reply.
          > Thanks in advance buddies
          >

          You'll need to look at a SQLLite SQL reference and see what SQL statements
          you should use for this. I think SQLLite syntax is a bit strange compared
          to other SQL, but look for CREATE TABLE and go from there.

          HTH;

          Amy


          • 2. Re: How to Copy SQLite Database to an Encrypted SQLite Databse ?
            manofspirit Level 1
            Thanks for the reply

            I know Simple Creat Table , Select, Insert, Delete etc
            But i dont know how will i copy a Database Scheme and on that schema how will i create a database?
            • 3. Re: How to Copy SQLite Database to an Encrypted SQLite Databse ?
              Level 7

              "manofspirit" <webforumsuser@macromedia.com> wrote in message
              news:gitido$bag$1@forums.macromedia.com...
              > Thanks for the reply
              >
              > I know Simple Creat Table , Select, Insert, Delete etc
              > But i dont know how will i copy a Database Scheme and on that schema how
              > will i create a database?

              SQLLite may have something you can query to get the existing table
              structure. I think you're going to have to research this.


              • 5. Re: How to Copy SQLite Database to an Encrypted SQLite Databse ?
                flexstone Level 1
                I stumbled on the "sql" property of a SQLSchema object which is the original SQL statement used to create the object.

                I wrote a simple AS method to mimic the standard mySQL "describe" function (not in SQLite) . Careful the AS code below can be corrupted after submitting this post.....characters stripped out , etc....

                public function describeTable(T:String,dbfile:File):String{

                var newConn:SQLConnection = new SQLConnection()
                newConn.open(dbfile)
                newConn.loadSchema()

                var schemaResult:SQLSchemaResult = newConn.getSchemaResult();
                var schema=schemaResult.tables

                // loop through the database to find the table (T)
                for each(var tab in schema){
                if(T.match(tab.name)){
                var dump = tab.sql
                break;
                }
                }

                return dump;
                }