Myna 1.0 Alpha 13 Release Change Log

Released: 07/06/2009

New Features:

  • (per Jeff Bader) Added Array aggregate functions: min, max, sum, and avg
  • (per Jeff Bader) Added support for Myna.DataSet, an extension of Array for managing arrays of objects, optionally with a loader function. DataSets bring the data handling of query result sets , without requiring a query. Here are some examples of DataSet in action:
//Create Dataaet from a regular array:
var DS = new Myna.DataSet([{dude:"bob"},{dude:"bob2"}])

//Create DataSet from a loader:
DS = new Myna.DataSet({
    columns:"label,value",
    loader:function(options){
        return Array.dim(options.maxRows).map(function(d,index){
            return {
                value:index+options.startRow,
                label:"Label #" +(index+options.startRow)
            }
        })
    }
})
DS.load({startRow:1,maxRows:10}); //load the first 10 rows
DS.load({startRow:11,maxRows:10}); //replace with the second 10 rows

//Create DataSet from a Query:
var DS = new Myna.Query({
 ds:"myna_log",
 sql:"Select * from myna_log_general",
 maxRows:10
}).data
//Query.data is now a DataSet

//DataSets have several functions that make them easier to work with:

//returns an array of all values in the "request_elapsed" column
DS.valueArray("request_elapsed"); 

//returns the row that contains The highest request elpased time 
DS.maxByCol("request_elapsed"); 

//treat the DataSet as a hashtable via any column
var bob = DS.findFirst("employee_id",/123658332/)

  • (per Jeff Bader) Added PUT and DELETE methods to HttpConnection. This can be helpful for calling RESTful services
  • (per Jeff Bader) Added Global server scope via $server.set(key,value) and $server.get(key). Values set in the server scope are persisted between requests until the server (JVM) is restarted
  • (per Jeff Bader) Added findBeans to DataManager. This works like manager.find() except it returns a DataSet of bean objects instead of just the ids
  • Modified Myna.DataManager.ManagerBase to have setters and getters for each column that call the the appropriate set_<column> and get_<column> functions. This means you can use the aggregate functions:
  • var avgOrder = orderManager
                  .findBeans({customer_id:"1234567"})
                  .avgByCol("order_total")
    
    
  • (per Jeff Bader) Added Myna.DataManager.BeanBase.getParent(). this function attempts to retrieve the parent bean for this bean via a foreign key.
  •  
    var orderBean = new Myna.DataManager("myapp")
                    .getManager("orders")
                    .getById(curOrderId);
    var customerBean = orderBean.getParent("customer_id");
    Myna.print(customerBean.last_name);
  • (per Jeff Bader) Added getChildren to DataManager.BeanBase.prototype. This returns a DataSet of matching beans in the supplied child table
  •  
    var customerBean = new Myna.DataManager("myapp")
                       .getManager("customers")
                       .getById(curCustomerId);
    var orders = orderBean.getChildren();
    Myna.print("Orders Total: " +orders.sumByCol("order_total")); 

Other Changes:

  • Altered "Append Profiler Output" setting to log to myna_log_general instead of  appending to page output. Altered setting name and help text to "Log Profiler    Output"
  • Updated docs for HttpConnection
  • Removed error when a Thread calls itself.    
  • Updated Thread docs
  • Improved error logging in threads
  • Fixed bug in Myna.JavaUtils.beanToObject
  • Modified Myna.Dump to handle DataSet objects