How to use the nativescript-sqlite.VALUESARENATIVE function in nativescript-sqlite

To help you get started, we’ve selected a few nativescript-sqlite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NathanaelA / nativescript-sqlite / demo / app / main-page.js View on Github external
function runNativeObjectTest(callback) {
	console.log("!--------------  Starting RNO Test");
	db.resultType(sqlite.RESULTSASOBJECT);
	db.valueType(sqlite.VALUESARENATIVE);

	const tests = [
		// Callback
		{name: 'NativeObject Get', sql: 'select * from tests where int_field=?', values: [2], results: {int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}, use: 0},
		{name: 'NativeObject All', sql: 'select * from tests order by int_field', results: [{int_field: 1, num_field: 1.2, real_field: 2.4, text_field: 'Text1'},{int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}], use: 1},
		{name: 'NativeObject Each', sql: 'select * from tests order by int_field', results: [{int_field: 1, num_field: 1.2, real_field: 2.4, text_field: 'Text1'},{int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}], use: 2},

		// Promise
		{name: 'NativeObject Promise Get', sql: 'select * from tests where int_field=?', values: [2], results: {int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}, use: 3},
		{name: 'NativeObject Promise All', sql: 'select * from tests order by int_field', results: [{int_field: 1, num_field: 1.2, real_field: 2.4, text_field: 'Text1'},{int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}], use: 4},
		{name: 'NativeObject Promise Each', sql: 'select * from tests order by int_field', results: [{int_field: 1, num_field: 1.2, real_field: 2.4, text_field: 'Text1'},{int_field: 2, num_field: 4.8, real_field: 5.6, text_field: 'Text2'}], use: 5}

	];
	runTestGroup(tests, callback);
}
github bradyhouse / house / fiddles / nativeScript / fiddle-0009-SqliteDb / puzzle / platforms / ios / puzzle / app / shared / db.service.js View on Github external
function onSelectMinHighScore(db, level, fn, scope) {
  consoleLogMsg("db.service", "onSelectMinHighScore");
  var query = sql.selectMinHighScore + level;
  consoleLogMsg("sql", query);
  if (db) {
    db.resultType(Sqlite.RESULTSASOBJECT);
    db.valueType(Sqlite.VALUESARENATIVE);
    db.all(query, function (err, items) {
      var data = [];
      if (err) {
        console.error(err);
      } else {
        if (items && items.length) {
          items.forEach(function (item) {
            var record = {
              moves: item.moves ? item.moves : 0
            }
            data.push(record);
          });
        }
        if (typeof fn === "function") {
          if (scope) {
            fn.apply(scope, data);
github NathanaelA / nativescript-sqlite / demo / app / main-page.js View on Github external
function runPreparedTests(callback) {
	if (!sqlite.HAS_COMMERCIAL) {
		callback();
		return;
	}
	db.resultType(sqlite.RESULTSASARRAY);
	db.valueType(sqlite.VALUESARENATIVE);

	setupPreparedTests(function() {
		createPreparedData(true, function () {

			let tests = [{
				name: 'Verify Rollback Check',
				sql: 'select count(*) from preparetests',
				results: [0],
				use: 0
			}];
			runTestGroup(tests, function () {
				createPreparedData(false, function () {

					tests = [{
						name: 'Verify Commit Check',
						sql: 'select count(*) from preparetests',
github bradyhouse / house / fiddles / nativeScript / fiddle-0009-SqliteDb / puzzle / platforms / ios / puzzle / app / shared / db-config.service.js View on Github external
function onSelectLevel(db, fn, scope) {
  consoleLogMsg("db-config.service", "onSelectLevel");
  data.length = 0;
  if (db) {
    db.resultType(Sqlite.RESULTSASOBJECT);
    db.valueType(Sqlite.VALUESARENATIVE);
    db.all(sql.selectLevel, function (err, items) {
      if (err) {
        onDbCallback([err], fn, scope);
      } else {
        if (items && items.length) {
          items.forEach(function (item, index) {
            var record = {
              level: item.level
            };
            data.push(record);
          });
        }
        onDbCallback([data], fn, scope);
      }
    });
  } else {