SQLite TRUNCATE in Air?

I'm looking to truncate my database.  According to SQLite documentation, issuing a "DELETE FROM databaseName" should run a fast truncate.  This does not seem to work within AIR from my tests.  It (the documentation) also states that"The truncate optimization can be permanently disabled for all queries by recompiling SQLite with the SQLITE_OMIT_TRUNCATE_OPTIMIZATION compile-time switch".
Was this the decision here?  Will I need to copy my table, drop the table, rename the copy, and then run my SQLStatements to do a simple truncate?
Source: http://www.sqlite.org/lang_delete.html

Nevermind, it appears to simply be an error/issue from within Lita, an AIR application that was developed to manage SQLite databases.  It works fine when run directly from my application.
My apologies.

Similar Messages

  • How to save the date in Sqlite in Adobe Air application

    hi friends,
    i am doing a flex Adobe AIR Application with SQLITE Data base,in that i want to save Date in the following format DD/MM/YYYY, but in my TABLE i gave the data type is DATE,
    So it store the value like this Sun Dec 2 00:00:00 GMT+0530 2012.i want to store the value in DD/MM/YYYY.How to do that?
    looking for useful suggession.
    Cheers,
    B.venkatesan.

    Hi, maybe cannot help much on this since I have not much experiense on handling SQLITE in AIR.
    But I know there are a command/example for reading SQL:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/data/SQLConnectio n.html
    http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7d49.html
    And in mxml you should have an id for each individual TextInput component, also have a button:
    <Button click="updateSQLHandler(event)"/>
    When the button is click the handler function is launched.
    The updateSQLHandler(event:MouseEvent) is a script that read the each individual TextInput component by getting (id of textinput component).text.
    Then, you create a String varible that is an SQL commands with the texts in the form, and update the SQL database following the below using the execute() command (refer to http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7d49.html ).
    Hope this help.

  • Air - Sqlite with Adobe Air insert data in memory, but do not record on the database file

    I have the code:
    var statement:SQLStatement = new SQLStatement();
    statement.addEventListener(SQLEvent.RESULT, insertResult);
    statement.addEventListener(SQLErrorEvent.ERROR, insertError);
    statement.sqlConnection = sqlConnection;
    statement.text = "insert into table values('"+TINome.text+"','"+TISerial.text+"') ";
    statement.execute();
    This run without error and the data is inserted (i dont know where), but when i see into database with firefox sqlite manager, the database is empty! But the Air continue run for a time like the data was recorded on the database file. I dont know what is happen with it.
    Help please!

    Toplink In Memory was developed by our project to solve this problem. It allows us to run our test either in memory or against the database.
    In memory, we basically stub out the database. This allows us to speed up our tests about 75x (In memory we run 7600 tests in 200 secs, it takes about 5 hours against the database). However, it throws away things like transactions, so you can't test things like rollback.
    In database mode, it just uses toplink, Another benefit of it though is that it watches all the objects created allowing an automatic cleanup of created test objects - keeping your database clean and preventing test interactions.
    We used HSQL running in memory previously, it worked fine. However, we needed to write scripts to translate our Oracle SQL into HSQL. Also, we had to override things like the data function in HSQL, and a few of our queries behaved unexpectedly in HSQL. We later abandoned it, as it became a lot of maintenance. It was about 10x faster than running against Oracle.
    Interestingly, we install oracle on all our developers machines too, tests run way faster locally, and developers feel way more comfortable experimenting with a local instance than with a shared instance.
    You can find the toplink in memory stuff at:
    http://toplink-in-mem.sourceforge.net/
    I provide all support for it. Doc is sketchy but I'm happy to guide you through stuff and help out where I can with it.
    - ted

  • Include SQLite in adobe air installer package

    Is it possible to have a SQLite DB included in the air installer package?
    I don't want to have the DB created when the application runs, I want to install it when the application installs.
    I also want to install it to the All Users>Application Data folder.
    Any help would be greatly appreciated.

    Yes. Just include the database file in the application package.
    There is no way to instruct the installer to put it into a special destination directory. Your app will have to check for the db file's existence and copy it to the right place if it is not there.

  • How to connect to and communicate with an SQLite database in AIR/Flex

    Hey guys,
    I recently decided I would try programming a vocabulary-training program in AIR, so I could use it on Linux as well. I got stuck pretty soon. I am trying to connect to a local SQLite database and I obviously fail epically. Posting the source code of the application here:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
       <mx:Script>
          <![CDATA[  
               import flash.filesystem.File;
              import flash.data.*;
             import mx.controls.Alert; 
                      private var dbFile:File;
                   private var conn:SQLConnection;
                   // -- AUTO INIT FUNCTIONS --------------------------------------------------- /
                   private function init():void {
                        // Create a File Reference to the Included DB
                        dbFile = File.applicationDirectory.resolvePath( "../slovniky.db" );
                        // Create SQL Connection
                        conn = new SQLConnection();
                        // Event Listener that will tell us when the DB is opened
                        conn.addEventListener(SQLEvent.OPEN, openSuccess);
                        // Event Listener that will tell us if an error occurs
                        conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
                   // -- EVENT HANDLERS -------------------------------------------------------- /
             private function starter() :void {
                  slovickoEn.enabled = true;
                  nazor.enabled = true;
                  odeslat.enabled = true;
                  zrusit.enabled = true;
                  start.enabled = false;
                  // Otevírám spojení s databází v asynchroním módu
                   conn.openAsync( dbFile );
             private function openSuccess( event:SQLEvent ):void {
                        // Pokud se spojení povede!
                        Alert.show("Spojení se zdařilo!");
               private function openFailure( event:SQLEvent ):void {
                        // Pokud spojení selže!
                        Alert.show("Spojení se nezdařilo!")
             private function kontrola() : void {
                  if (nazor.text != "") {
                       if (nazor.text == "Pes") {
                       Alert.show("Správně!");    
                       else {
                       Alert.show("Špatně!! " + "Napsané slovíčko bylo " + nazor.text);     
          ]]>   
       </mx:Script>
       <mx:VBox width="400" height="200"
                   horizontalCenter="0" verticalCenter="0" backgroundColor="#FFFFFF"
                   paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20"
       >
          <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="center">
             <mx:Label text="Anglicky:"/>
             <mx:TextInput id="slovickoEn" editable="false" text="Dog" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" verticalAlign="middle" horizontalAlign="center">
             <mx:Label text="Česky:"/>
             <mx:TextInput id="nazor"  enter="kontrola()" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" horizontalAlign="center">
             <mx:Spacer width="50" height="10"/>
             <mx:Button id="odeslat" label="Odeslat" color="#0D8401" click="kontrola()" enabled="false"/>
             <mx:Button id="zrusit" label="Zrušit" color="#0D8401" enabled="false"/>
          </mx:HBox>
          <mx:HBox width="100%" horizontalAlign="center">
             <mx:Spacer width="50" height="10"/>
             <mx:Button id="start" label="Start" color="#0D8401" click="starter()" enabled="true"/>
          </mx:HBox>
       </mx:VBox>
    </mx:WindowedApplication>
    The Run of the program tells me this:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
         at pes/starter()[C:\air\projects\pes\src\pes.mxml:45]
         at pes/__start_click()[C:\air\projects\pes\src\pes.mxml:93]
    I would appreciate any help or a how-to. I am an absolute beginner with some experience from HTML, CSS, PHP and rarely JS. What am I doing wrong? File attached for easier manipulation as well.
    Erthy

    Hi,
    Here is the complete example for the same with the code.Let me know if you have any issue with this.
    http://shardulbartwal.wordpress.com/2008/04/14/adobe-air-and-sqlite-connectivity/
    with Regards,
    Shardul Singh Bartwal

  • How to embed SQLite database to Air app?

    Now I connect to a database file like this:
    var dbFile:File = File.applicationStorageDirectory.resolvePath("myDB.db");
    conn = new SQLConnection();
    conn.openAsync(dbFile);
    conn.addEventListener(SQLEvent.OPEN, openSuccess);
    conn.addEventListener(SQLErrorEvent.ERROR, openFailure);
    Tell me please, how do I embed the DB file to the application? I need to have the database inside a swf.

    Here's info on encrypting a database in AIR:
    Creating an encrypted database
    Working with the encrypted local SQLite database
    flash.data.SQLConnection
    Chris

  • Distribute SQLite-DB with AIR Application?

    Hi!
    Is it possible to distribute an SQLite-DB along with an AIR
    Application? By distribute I mean passing along a premade database
    instead of creating it with code at application startup. Don't want
    to run alot of CREATE TABLE and such at startup, even if it should
    only occur once.
    Thanks!

    I just discovered this developer's github page yesterday and perhaps his air_amf_sync project may be beneficial to you.
    https://github.com/dima/air_amf_sync
    Let us know on your outcome.

  • SQLite encrypted Database does not get attached Using Adobe Air,Why?

    Hi,
    Any one knows the solution, am trying to attach the encrypted SQLite database adobe air-adobe flex bulder , it does not get attached using sqlconnection.attach throws error, though the given key is correct, but it gets open using sqlconnection.open with the same key, any one knows the solution, how to attach the encrypted data base, since am using two data base one is opened and another must be attached to the existing ,thanks in advance. using adobe air- flex related. i use the following code
                   databaseFile1 = File.applicationStorageDirectory.resolvePath("Sample_1.sqlite");
                   databaseFile2 = File.applicationStorageDirectory.resolvePath("Sample_2.sqlite");
    dbConnection.open(databaseFile1, SQLMode.CREATE, false, 1024, secKey);
    dbConnection.attach("db2",databaseFile2,null,secKey);
    got the following error.
    ERROR #3125 Unable to open the database file.

    And I would say more "this is the issue" !
    It should be possible as it is clearly stated in the doc :
    public function attach(name:String, reference:Object = null, responder:Responder = null, encryptionKey:ByteArray = null):void
    with 
    encryptionKey:ByteArray (default = null) — The encryption key for the database file. If the attach() call creates a database, the database is encrypted and the specified key is used as the encryption key for the database. If the call attaches an existing encrypted database, the value must match the database's encryption key or an error occurs. If the database being attached is not encrypted, or to create an unencrypted database, the value must be null (the default).
    so with a same encryptionkey, I (and this should be the same for FinalTarget) can open the encrypted db but not to attach it... quite strange.

  • Flex Air App... and SQLite

    I was hoping someone can point me in the direction to learn the SQLite on Adobe Air... I need something simple to start out... Most of what i found is rather complicated, and get's kind of confusing...
    Do you have to create the database at run-time?

    http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/
    http://work.rowanhick.com/2007/06/12/working-air-sqlite-datagrid-example/

  • Adobe Air SQLite Concurrency/Best Practices

    Hello Everyone,
      I posted this on Stackoverflow, but I was wondering if there were any I guess design patterns or hints concerning the usage of a SQLite DB.  I'm asking this mostly because with the Adobe Air sqlite implementation, you can't modify the timeout, so you have to re-architect your application to try and retry your sql statements.
    I am attempting to use a SQLite DB with an AIR project and there seem to be a few questions that I just can't seem to find the answers to on the internet, especially ones concerning best practices.
    The first is about having multiple connections in the same application instance.  Some application processes require the use of a db for a split second, and would better be served by a synchronous type code flow (try{}catch(){}).  Some processes may take awhile and would be better served by an asynchronous code flow with an AsyncResponder.  Because of this, I have thought about having a ConnectionPoolManager which would have multiple instances of async and one instance of my sync SQLConnection classes.  Is this a decent, good or absolutely atrocious idea ?  This leads me to my next point.
    Is there any issue of having multiple async connections running their async statements in parallel ?  I've seen some people complain about the db being locked, and I've read that only one statement can perform a write at a time.   What happens if a write statement gets called to execute(new Async...) while another one is busy ?  Will an error be thrown, or will it wait for a timeout ?
    Any clarification about this issue would be greatly appreciated.  I keep running into sources that kind of answer one-off questions but not my question in particular.  Usually I would go test it myself, but I'm worried I may not be able to reproduce the pitfall error that will only manifest itself at heavier usage levels.

    I'd suggest checking out the following links for tips and
    source code for best practices on SQLite:
    http://www.adobe.com/devnet/air/flex/articles/air_sql_operations.html
    http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/
    - Rob

  • Unicode in SQLite and AIR

    Hi guys
    I want certain columns in my SQLite database to be able to accept unicode characters such as • and accented characters such as á. Is this possible in the SQLite version that AIR uses?
    If so, what do I need to use when setting up my tables...
                                     "CREATE TABLE IF NOT EXISTS tester10 (" +
                                     "    id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                                     "    Col1 NVARCHAR, " +
                                     "    Col2 NVARCHAR, " +
                                     "    Col3 NVARCHAR" +
    I thought NVARCHAR would do it, but it's entering the bullet point like: • and accented á like: Ái
    Thanks for your help.

    This may help ( http://www.sqlite.org/faq.html#q18 ):
    quote:
    (18) Case-insensitive matching of Unicode characters does not work.
    The default configuration of SQLite only supports case-insensitive comparisons of ASCII characters. The reason for this is that doing full Unicode case-insensitive comparisons and case conversions requires tables and logic that would nearly double the size of the SQLite library. The SQLite developers reason that any application that needs full Unicode case support probably already has the necessary tables and functions and so SQLite should not take up space to duplicate this ability. 
    Instead of providing full Unicode case support by default, SQLite provides the ability to link against external Unicode comparison and conversion routines. The application can overload the built-in NOCASE collating sequence (using sqlite3_create_collation()) and the built-in like(), upper(), and lower() functions (using sqlite3_create_function()). The SQLite source code includes an "ICU" extension that does these overloads. Or, developers can write their own overloads based on their own Unicode-aware comparison routines already contained within their project.

  • AIR and full-text search in SQLite

    Hi,
    can I use full-text indexing capabilities of SQLite with my
    AIR app?
    I've created a virtual table in database using fts3 module
    (via command line of sqlite.exe). But when I try to insert a row
    into this table, I get an error message like
    ...SQLError: 'Error #3115: SQL Error.', details:'no such
    module: fts3', operation:'execute', detailID:'2501'...
    Does AIR Data library support FTS in SQLite?

    Yes, Adobe has disabled loadable modules but that does not
    prevent them from including FTS3 in AIR's SQLite.
    PLEASE, statically compile in both the FTS3 module and the
    R*Tree Spatial Index module.
    The beauty of AIR is that you can have an application that
    works offline (duh!, right?). When it's online, you can do a full
    text search in it, using the powerful server-side database's
    functionality. Now when you go offline, you're completely crippled!
    ... Because Adobe didn't put FTS3 in SQLite.
    ' Same with Spatial functionality.
    I'd sure like to know how companies make these decisions.
    >sigh< It is EXTREMELY frustrating to be limited by
    apparently arbitrary decisions like these. I sure hope this was not
    motivated by a desire to "encourage" people to use their commercial
    productions such as BlazeDS. I'd like to think better of Adobe than
    that.
    Again, PLEASE include these modules in the next release.
    Scott

  • AIR desktop app (Windows 7) - Big data set, XML or SQLlite?

    I am developing an AIR desktop application for a Windows 7 touch screen kiosk that needs to access and allow users to search a set of data, which could initially contain anywhere between 17,000 and 100,000 records. Each record could have perhaps 15 to 20 fields, and all the data will be stored locally on the computer, and updated with new data by memory stick, perhaps once per month. The kiosk will not be connected to the internet.
    Can anyone offer any advice as to the viability / limitations of using XML, SQLLite, or some other means of data storage, to access this information from an AIR application?

    You can do a general search for XML vs SQLite and find that a good deal of the answers say to go with SQLite for this sort of data set and one of that size. SQLite will probably be faster from an access standpoint but has a lot more overhead on setting up and getting working. XML in AS3, in my opinion of working with it for many years, is definitely easy to work with, especially compared to how other languages implement methods of reading/writing to XML. Have you done any work with either before? Below is a link to an Adobe article on working with SQLite in an AIR application.
    Adobe Flash Platform * Working with local SQL databases in AIR

  • Database access from AIR

    Hello all,
    I'm just getting started with AIR and I'm loving it! One
    thing that I can't seem to find any information about (perhaps
    because it hasn't been done...) is accessing information from a
    database without a (PHP or whatever) program on the server-side
    acting as an intermediary? I know that socket communications are
    available, are there AS / JS libraries available to do this?
    Thanks
    Allan

    You seem pretty conversant with sockets and all; just wanted
    to make sure you knew there is an embedded sqlite app within AIR.
    Don't mean to be patronizing, but if you're looking for a local
    machine solution, it's pretty cool.

  • SQLite Best Practices

    When I work with web-based SQL, I typically close connections
    as soon as I'm done because of the stateless nature of HTML. I'm
    wondering if that's really necessary when doing SQLite from an AIR
    app. Is there a good URL for best and most efficient practices with
    AIR and SQLite?

    I'd suggest checking out the following links for tips and
    source code for best practices on SQLite:
    http://www.adobe.com/devnet/air/flex/articles/air_sql_operations.html
    http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/
    - Rob

Maybe you are looking for