I reported a bug in APE MySQL, here is the code I posted on the GITHUB
page.  It shows a simple select but from that you should be able to
just change the SQL to INSERT, DELETE

/Andy




Ape.log(' =====================================>>> Start up for
mysql_test.js ' );

var dbbm = new Ape.MySQL( "1.1.1.1:3306", "mysql", "mysql",
"events" );

var events_Chan = false;
var events_timeoutID;

//------------------------------------------
Ape.addEvent("mkchan", function(chan) {

        var cj = chan.getProperty('name');
        Ape.log("New channel => " + cj );

        switch( cj )
        {
                case '*events':
                        Ape.log( 'Starting EVENTS thread at 5
seconds' );
                        events_timeoutID = Ape.setInterval(EventsTick,
5000, chan );
                        break;
        }

        Ape.join( cj );
});

//------------------------------------------
Ape.addEvent("join", function(user, channel) {
        Ape.log("New user has joined the channel (" +
channel.getProperty('name') + ")");
        // Do nothing this is just a crash test
});

//------------------------------------------
dbbm.onConnect = function() {
        Ape.log('Connected to mysql server, Creating *events
channel');
        events_Chan = Ape.mkChan('*events');
}

//------------------------------------------
dbbm.onError = function(errorNo) {
   Ape.log('Connection Error : ' + errorNo + ' : '+
this.errorString());
}

//------------------------------------------
function
EventsTick( _chan )
{
        var SQL = 'SELECT * ' +
                'FROM events '+
                'LIMIT 25';

        dbbm.query( SQL , function(res, errorNo) {
                if (errorNo)
                {
                        Ape.log('Request error : ' + errorNo + ' : '+
this.errorString());
                }
                else
                {
                        Ape.log('Fetched => ' + res.length + ' ROWS');
                        Ape.log( "SQL completed" );
                }

        });
}

-- 
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply via email to