Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
juanluep
Posts: 11
Registered: ‎02-04-2011
My Device: Not Specified

problen sqllite html5

Hi, I have a problem with SQLLite and html5

 

i have this function:

 

function CaseDatos(Funcion, Lat, Lon, Altitud, Precision, precisionAltura, Direccion, Velocidad, FechaGps) {
	if (blackberry.system.hasCapability('storage.memorycard')) {
		var capacidad = 2 * 1024 * 1024;
		baseDatos = openDatabase("posiciones", "1.0", "Almace de Posiciones", capacidad, null);
		switch (Funcion) {
		case "CreaTabla":
			if (baseDatos) {
				baseDatos.transaction(function(tx) {
					tx.executeSql("CREATE TABLE IF NOT EXISTS posiciones ("
							+ "id int unique, " + "Lat int, " + "Lon int, "
							+ "Precision int, " + "PrecisonAltitud int, "
							+ "FechaGps text, " + "Altitud int, "
							+ "Velocidad int, " + "Direccion int)", [],
							function (tx, r){
								alert ('Tabla creada correctamente');
					},
					function (tx, e){
						transaccion = false;
						alert ('Error en la Creación de la tabla '+ e.message);
					});
		transaccion = transaccion;
				});
			} else {
				alert("Error en la creación de datos");
			}
			break;
		case "Insertar":
			var transaccion;
			baseDatos.transaction(function(tx) {
				tx.executeSql('INSERT INTO posiciones (Lat, Lon,  Precision, precisionAltura, Direccion, FechaGps, Altitud, Velocidad) VALUE(?, ?, ?, ?, ?, ?, ?, ?)', [Lat, Lon,  Precision, precisionAltura, Direccion, FechaGps, Altitud, Velocidad],
							function (tx, r){
					alert ('Inserccion correcta');
							},
							function (tx, e){
								transaccion = false;
								alert ('Error en la trancsaccion de bd '+ e.message);
							});
				transaccion = transaccion;
				});
			break;
		}

	}else {
		alert ('Para el correcto funcionamiento de esta aplicacion necesita una tarjeta de memoria. La aplicacion se cerrara');
		blackberry.app.exit();
	}

}

but does not insert into the database

displays an error Unknown database error occured

 

you can help me, please

 



Please use plain text.