Entries for month: February 2009

SQLError: Error #3129: The database schema changed with Flex and AIR SQL Lite Database

This error occures when you create new tables and then try to insert, select, etc during the same database connection.

 

Adobe has it listed on their runtime errors page.

 

3129 The database schema changed. Indicates that the operation could not be completed because of a schema error. This occurs when the schema of the database changes after a statement is prepared but before it finishes executing, such as if two SQLConnection instances are connected to the same database, and one instance changes the schema while another one is reading it.

 

The solution is to use the .close() method. For example. SomeSQLLiteDB.close() should be the last statement after creating your new tables. Then use SomeSQLLiteDB.open() before your insert, select, etc statement is executed.

 

The solution is to call the .close() method when you complete creating your tables. Then you can call the .connect() method and select, insert, etc from the newly created tables.

SomeSQLLiteDB.close()

SomeSQLLiteDB.connect()

 

 

Custom Event Handler named add will fire when the compenent is added to stage.

In the example below, I've created a component named two.mxml and it's based on the Panel component. Inside the two.mxml component meta data defines an event called "add". Here is the problem, the Panel componenet already has a method called "add". It's fired when the component is added to the stage.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>
    <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
        title="Two"
        paddingBottom="10"
        paddingLeft="10"
        paddingRight="10"
        paddingTop="10">
        <mx:Script>
            <![CDATA[
            import com.TwoEvent;
            import flash.events.Event;
            public function addHandler(event:MouseEvent):void
            {
                var submitEvent:TwoEvent = new TwoEvent(TwoEvent.ADD);
                dispatchEvent(submitEvent);
            }
            ]]>
        </mx:Script>

        <mx:Metadata>
                [Event(name="add", type="flash.events.Event")]
        </mx:Metadata>

        <mx:Button label="Dispatch and Say Hello" click="addHandler(event)"/>
</mx:Panel>

 

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  layout="absolute" xmlns:local="*"
  viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;

            public function changeState():void
            {
                currentState='two';
             }

             public function SayHello():void
            {
                Alert.show("Hello Panel Two");
             }


        ]]>
</mx:Script>

<mx:states>
        <mx:State name="two">
                <mx:AddChild position="lastChild">
                    <local:two add="SayHello()" x="254.5" y="20" width="222" height="155" horizontalAlign="center" verticalAlign="middle"/>
                </mx:AddChild>
            </mx:State>
</mx:states>

      <mx:Panel title="One" width="195" height="155" x="28" y="20" id="panel1" horizontalAlign="center" verticalAlign="middle">
            <mx:Button label="Show Panel 2" click="changeState();" />
      </mx:Panel>
</mx:Application>

 

 

The easy solution is to rename the custom event in your two.mxml componenet from "add" to something like "addNew". This was something I stumbled over and hope this helps anyone who's made this same mistake.

 

 

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds