Coder Social home page Coder Social logo

Comments (4)

soyjavi avatar soyjavi commented on August 17, 2024

WebSQL is a async API... your example code it's async :).

Other example:

var selectTask = function(data){
    lng.Data.Sql.select('tasks', {done: 0}, function(result) {
        //Call to a method (to continue the flow)
        read_tasks(result);
    });
};

var read_tasks = function(data){
    for (var i=0; i < data.length; i++) {
        datos.push({
            id: data[i].id,
            name: data[i].name,
            description: data[i].description
        });
    }
    lng.Core.log(1, "Antes: " + datos.length);
};

from lungo.js.

kurnajata avatar kurnajata commented on August 17, 2024

Hola Javi,
En una prueba que estoy haciendo, también me sale mal con el código que has puesto.Al final (ojo, que soy nuevo!!) he hecho como lo tienes en Template.Bindings:

var data_type = lng.Core.toType(result);
    if (data_type === 'array') {
        for (var i=0; i < result.length;i++){    
            sumatorio += result[i].NombreCampo; 
        }    
    } else if (data_type === 'object') {
        sumatorio += result.NombreCampo;        
}

Si es un sólo registro Data.Sql devuelve un object.

Saludos,

Lungojs 1.0.3

from lungo.js.

soyjavi avatar soyjavi commented on August 17, 2024

Eso es si solo es un reistro devuelve un object ;) para una mejor perfomance

Enviado desde mi iPad

El 13/12/2011, a las 21:53, kurnajata
[email protected]
escribió:

Hola Javi,
En una prueba que estoy haciendo, también me sale mal con el código que has puesto.Al final (ojo, que soy nuevo!!) he hecho como lo tienes en Template.Bindings:

var data_type = lng.Core.toType(result);
   if (data_type === 'array') {
       for (var i=0; i < result.length;i++){
           sumatorio += result[i].NombreCampo;
       }
   } else if (data_type === 'object') {
       sumatorio += result.NombreCampo;
}

Si es un sólo registro Data.Sql devuelve un object.

Saludos,

Lungojs 1.0.3


Reply to this email directly or view it on GitHub:
#19 (comment)

from lungo.js.

colorlife2012 avatar colorlife2012 commented on August 17, 2024

Cound i use lungo like following?

 var result =  lng.Data.Sql.select('tasks', {done: 0} );
 or  
 var result =  lng.Data.Sql.select('tasks', {done: 0} ,'abc');


 i want the result, 
 but select doesnt give anything back,  only pass data to abc, but abc cant return anything.
 something wrong with my use? 
 thanks for helping.

from lungo.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.