Loading ...
Sorry, an error occurred while loading the content.

detecting existence of database table

Expand Messages
  • fwward2011
    I have a couple of questions. I have tried, after looking at some examples and trying a couple of them outside of the mobile app I am developing, to create
    Message 1 of 1 , Jul 19, 2012
    • 0 Attachment
      I have a couple of questions. I have tried, after looking at some examples and trying a couple of them outside of the mobile app I am developing, to create and insert and then dynamically display in a UL/LI the records inserted but I am not succeeding at this for some reason.


      Question 1):
      How do I check for the existence of a TaffyDB table?

      I am used to using the following javascript code to check for the existence of an object which is pretty typical javascript.

      if (type of object !== undefined) {
      do something . . . .
      }

      I have an ADD (or insert) routine that needs to check for the existence of the table and if it's not already been created then create it before trying to insert the records.

      Question 2):
      Do I need to alter my approach in creating dynamic UL/LI's to use the SUPPLANT directives?

      I have been successfully building dynamic UL/LI's in this mobile app up until now by using the following type of code (html += <li>), but it doesn't seem to work with TaffyDB.

      function getregList(startno) {
      if (typeof reglist !== 'undefined') {
      reglist().order("name asec");
      var listtotal = 0;
      html = '<ul id="reglist_ul">';
      reglist().start(startno);
      reglist().each(function (record,recordnumber) {
      listtotal++;
      html += '<li id="reglist_li">';
      html += '<div id="reglist_ref" style="display:none;">' + (record["reggeometry"]) + "," + (record["regreference"]) + '</div>';
      html += '<a href="#reglist_details" onclick="regDetails(' + (record["reggeometry"]) + "," + (record["regreference"]) + ');">' + (record["regname"]) + '</a>';
      html += '</li>';
      html += '<hr style="width:100%;height:3px;background-color:#1B1F52;border-color:#1B1F52">';
      if (listtotal == 20) {
      startno = 21;
      html += '<li id="def_li"><a href="getregList(startno);">' + 'Continue To Next Page ...' + '</a></li>';
      break;
      }
      });
      html += '</ul>';
      $('#reg-list').html(html);
      }
      else {
      html = '<h2 align="center">No regular list exists!</h2>';
      $('#reg-list').html(html);
      }
      }

      Question 3:
      Is it reasonable to assume that I can put different database functions in seperate SCRIPTS and call them passing the data to them that they need in order to ADD records to the tables and/or DELETE records from the tables?

      I have two tables that are going to consist of record-data obtained from using Google's Maps and Places API's. I really don't need any UPDATE abilities, just INSERT and DELETE (and remove all).

      I need to be able to 'load' the data using an "ONCLICK (data fields);" event handler, passing all the data for the record's fields in the onclick statement to the ADD function script and then redirect to a page to LIST the records. This doesn't seem to be working for me right now.

      Please advise on the above 3 questions.

      Thanks,
      Forrest Ward
      803-788-0141
      fwward2011@...
    Your message has been successfully submitted and would be delivered to recipients shortly.