SQLite and HTML

Anyone has any sample code to show how to use a set of HTML construction using the manipulation of the DOM, as in, SQL result using innerHTML?

Thank you

Here is the example, I used it on my recent project

kemasD.getCustomerById = function(id) {    var db = kemasD.webdb.db;

    db.transaction(function(tx){        tx.executeSql("SELECT * FROM CUSTOMER WHERE ID = ? ORDER BY ID",              [id],             function(tx, results) {                var buffer = "";

                // results = SQLite result set                if (results.rows && results.rows.length) {                    for ( var i = 0; i < results.rows.length; i++) {                        var current = results.rows.item(i);

                        // This part where you want to process the result and wrap it with HTML tag                        buffer += '
'; buffer += '

Customer name: ' + current.NAME + '

'; buffer += '

Customer address: ' + current.ADDRESS + '

'; buffer += '

Customer phone: ' + current.PHONE + '

'; buffer += '
'; // Modify the DOM using jQuery (this is the easiest way, AFAIK) // This syntax will insert the 'buffer' inside the
block // in your page $("div.customer-detail-box").prepend(buffer); buffer = ""; } } }, onErrorHandler); });};

Hope that this example will help you :))

Tags: BlackBerry Developers

Similar Questions

  • Where is the icon of firefox on the document htm and html files?

    Today, I noticed for the first time... The icon to look like a blank page with a firefox icon on this mini... Htm and html icon now looks like a blank white page which is curved on the upper right... I tried a reset of firefox and it did not help... I don't want to do a reinstall of firefox because I want to keep the old firefox download manager and not one which is on the right side of the search bar... (I saw it on my linux ubuntu computer) BUT my computer with the html file icon problem is Windows 7 x 64

    It does not say it is a Firefox HTML Document, but it does not show the icon of firefox on the html file icon... I will uninstall and reinstall... I hope this will help

  • SQLite and Images

    Hello world

    I have a problem with Sqlite and the BLOB data type, and Google was not helpful, because I guess that there is no just enough examples yet...

    What I do is the following: I use sqlite to store Images as blobs, as seen here. The table has only two columns, url TEXT and BLOB value

                 connection.begin();
    
                  sql = "INSERT INTO blobs (url, value) VALUES (@a, @b)";               sqlStatement.text = sql;
    
                  for (var i:int = 0, n:int = images.length; i < n; i++)             {                 sqlStatement.parameters["@a"] = images[i].url;                    sqlStatement.parameters["@b"] = images[i].data;                   sqlStatement.execute();                   sqlStatement.clearParameters();               }
    
                  connection.commit();
    

    whereas the images [i] .url are strings, data BitmapData.

    Now the question is: How can I get the image of the BitmapData again? What I'm trying to do is the following

    public function getBlob(url:String = null):Object
            {
                var dp:DataProvider = new DataProvider;
                try {
                    connection.begin(); 
    
                    var sql:String;
    
                    if (url)
                    {
                    sql = "SELECT value FROM blobs WHERE url = @a";
                    sqlStatement.text = sql;
                    sqlStatement.parameters["@a"] = url;
                    }
                    else
                    {
                        sql = "SELECT * FROM blobs";
                        sqlStatement.text = sql;
                    }
                    sqlStatement.execute();
                    sqlStatement.clearParameters();
    
                    var result:SQLResult = sqlStatement.getResult();
                    for each (var obj:Object in result.data){
                        if (obj != null)
                            dp.addItem(obj);
                    }
    
                    connection.commit();
    
                } catch (e:SQLError) {
                    alert.title = "Database Error (" + e.errorID + ")";
                    alert.message = "Error: " + e.message + "\n" + e.details;
                    alert.modalAlpha = 0.1;
                    alert.dialogSize = DialogSize.SIZE_SMALL;
                    alert.addButton("OK");
                    alert.show(IowWindow.getAirWindow().group);
                    connection.rollback();
                    return null;
                }   
    
                return dp;
            }
    

    and

    var dp:DataProvider = getBlob(_newUrl) as DataProvider;
    trace(dp.data[0].value is BitmapData);
    

    but which always returns false: All that it is said that dp.data [0] .value is an object which I can't access

    Any tips?

    This seems to work, using built bitmapData as byteArray, getPixels, setPixels.

    Thank you

    MIke

    package
    {
        import flash.data.SQLConnection;
        import flash.data.SQLResult;
        import flash.data.SQLStatement;
        import flash.display.Bitmap;
        import flash.display.BitmapData;
        import flash.display.Sprite;
        import flash.errors.SQLError;
        import flash.filesystem.File;
        import flash.geom.Rectangle;
        import flash.utils.ByteArray;
    
        [SWF(width="1024", height="600", backgroundColor="#cccccc", frameRate="30")]
    
        public class SQLBitmapBlob extends Sprite
        {
            private var sqlDatabase:File;
            private var sqlConnection:SQLConnection;
            private var sqlStatement:SQLStatement;
            private var sqlResult:SQLResult;
    
            private static const BITMAP_WIDTH:int = 96;
            private static const BITMAP_HEIGHT:int = 96;
    
            public function SQLBitmapBlob()
            {
                super();
    
                // Init Database
                sqlDatabase = File.applicationStorageDirectory.resolvePath("dbBlob2.db");
                sqlConnection = new SQLConnection();
                sqlConnection.open(sqlDatabase);
                sqlStatement = new SQLStatement();
                sqlStatement.sqlConnection = sqlConnection;
    
                // Create the table if it doesn't exist
                sqlStatement.text = "CREATE TABLE IF NOT EXISTS blob (id INTEGER PRIMARY KEY AUTOINCREMENT, picture BLOB)";
                try{sqlStatement.execute();}
                catch (error:SQLError){trace("SQL STATEMENT: " + sqlStatement.text + "\n Error: " + error.details);}
    
                // Create a random bitmapData
                var bmpData:BitmapData = new BitmapData(BITMAP_WIDTH, BITMAP_HEIGHT, true, 0x000000);
                var bytArray:ByteArray = new ByteArray;
                bmpData.noise(25);
                bytArray.writeBytes(bmpData.getPixels(new Rectangle(0,0, BITMAP_WIDTH, BITMAP_HEIGHT)));
    
                // Save BitmapData to Database
                sqlStatement.text = "INSERT INTO blob (picture) VALUES (@picture)";
                sqlStatement.clearParameters();
                sqlStatement.parameters["@picture"] = bytArray;
                try {sqlStatement.execute();}
                catch (error:SQLError){trace("SQL STATEMENT: " + sqlStatement.text + "\n Error: " + error.details);}
    
                // Preform Select on Database to return row
                var loadedBitmapData:BitmapData = new BitmapData(BITMAP_WIDTH, BITMAP_HEIGHT, true, 0x000000);
                sqlStatement.text = "SELECT * FROM blob WHERE id = last_insert_rowid()";
                sqlStatement.clearParameters();
                try{sqlStatement.execute();}
                catch (error:SQLError){trace("SQL STATEMENT: " + sqlStatement.text + "\n Error: " + error.details);}
    
                // Convert returned data back to bitmapData
                var r:Object = new Object();
                sqlResult = sqlStatement.getResult();
                if (sqlResult.data != null){
                    r = sqlResult.data[0].picture;
                    loadedBitmapData.setPixels(new Rectangle(0,0, BITMAP_WIDTH, BITMAP_HEIGHT), r as ByteArray);
                    trace("Retrievied record id: " + sqlResult.data[0].id + " from db.");
                }
    
                var bmpDisplay:Bitmap = new Bitmap(loadedBitmapData);
                addChild(bmpDisplay);
            }
        }
    }
    
  • Is there a way to shrink js, css and html in DreamweaverCC?

    Is there a way to shrink js, css and html in DreamweaverCC or on-line what program is best to use?  When I minify the css just replace what is in my models or what is the process?  Thanks in advance.

    I don't shrink HTML code. I believe that it is very little reward for any problems this may cause.   My server GZIP compression is sufficient.

    Code editor in parentheses with at LEAST the module automatically minifies CSS code when you save the file UNDER.  It is a nice feature.  For now, DW doesn't have this option.  Maybe it will be in 2016 when the media is integrated in DW.  Will have to wait and see.

    My CSS code is still in external style sheets.

    • stylsheet.min.CSS
    • StyleSheet.CSS

    I keep a non-compressed for backup.  I have download the compressed on the server version.

    There are also online minification tools, that you can use.  A Google search will reveal many each with their own advantages and disadvantages.   In order to test before replace you the original code with the compressed versions.

    JavaScript Minifier

    Nancy O.

  • the .swf and .html files does not work while the .fla file works great

    Hi I'm new to actionscript, and I have a question. The fla file works perfectly and runs the timer function and reads the xml file to create an RSS feed, but when I publish and choose HTML wrapper and then choose 14 Flash swf and html file load the photos and the text field but isn't something else please help.

    Thanks in advance.

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import flash.events.Event;

    import flash.text.TextField;

    import flash.text. *;

    import flash.utils.Timer;

    import flash.events.TimerEvent;

    var RSSLoader:URLLoader = new URLLoader();

    var RSSURL:URLRequest = new URLRequest ("http://sports.yahoo.com/soccer//rss.xml");

    RSSLoader.addEventListener (Event.COMPLETE, RSSLoaded);

    RSSLoader.load (RSSURL);

    var RSSXML:XML = new XML();

    RSSXML.ignoreWhitespace = true;

    var title: TextField;

    var desc:TextField;

    var allText:TextField;

    title = new TextField();

    allText = new TextField();

    var i: int;

    function RSSLoaded(e:Event):void {}

    trace ("xml load file here");

    RSSXML = XML (RSSLoader.data);

    for {(var selectedItems:String in RSSXML.channel.item)

    title. Text = (RSSXML.channel.item [selectedItems] .title + "/");

    title.wordWrap = true;

    tfLog.text += title.text;

    tfLog.wordWrap = true;

    trace (title. (Text);

    }

    }

    var t:Timer = new Timer (200);

    t.addEventListener)

    TimerEvent.TIMER,

    function(EV:TimerEvent): void

    {

    tfLog.text tfLog.text.substr = (1) + tfLog.text.charAt (0);

    }

    );

    t.Start ();

    var picTimer:Timer = new Timer (2000);

    picTimer.start ();

    picTimer.addEventListener (TimerEvent.TIMER, timehandler);

    function timehandler(event:TimerEvent):void {}

    setChildIndex (getChildAt (7), 0);

    }

    A way around that is to have a PHP file on your server that reads the XML feed and your swf reads the data from the PHP file rather than directly from the external domain.

  • Is it possible to export a page as muse and html associated individual with css?

    Is it possible to export a page as muse and html associated individual with css?

    Yes, Muse has an export as HTML feature.

  • Problem with the publication of a swf and html in CS5 file

    Hey, I'm a newbee in flash. I use Flsh cs5. I created a simple .fla file. But when I publish, .swf and .html file are not created in the folder.

    And when I test the movie (control-> test movie), it does not open any window to display the flash.

    Help, please.

    Click on file/publish/formats settings, make sure that the swf and html boxes are selected, and click the button use default namespace.  then click on file/publish.  are the files in your directory with your fla?

    Otherwise, create a new directory (which has no subdirectory), save your fla to this new directory using a new name (it is, click File/Save as).  then click on file/publish.  see the new directory for your 3 files.

  • SQLite and Malwarebytes files

    Whenever I run Malwarebytes on my laptop Win 7 I get at least 69 elements referring to the sqlite files.

    I don't know whether to remove them or not. I don't have this problem on my Vista desktop.

    If I have, or I should NOT delete these files when Mo found after a scan. They claim it ADWARE.

    I just checked, and they are all cookies. I then checked the details I've ever done and it shows a bunch of advertisements like Double click, etc.

    I'll do as suggest you and close the browser before I remove them.

    I wonder why this only happens on the Windows 7 operating system and never on my desk.

    Thank you. I guess it's safe to delete.

  • Firefox 4. What is the difference between addons.sqlite and extensions.sqlite in the profile folder?

    I have separate facilities 3.6.15 Firefox and Firefox 4RC2, using their own separate and distinct profile folders.

    I already know that, in the profile folder:

    • Firefox 3.6.x has extensions.log, extensions.ini and extensions.rdf files
    • Firefox 4 has replaced extensions.rdf with extensions.sqlite
    • Firefox 4 has apparently no extensions.log
    • Firefox 3.6.x does not have addons.sqlite
    • Firefox 4 is has addons.sqlite

    For a better understanding of the present, can someone please clearly, answer the following 3 questions?

    What is

    1. the purpose of addons.sqlite in Firefox 4?
    2. How it / its function differ from the extensions.sqlite in Firefox 4
    3. both are really necessary?

    addons.SQLite stores the information that appears in the tab Addons > Extensions - under the button more , as well as the AMO URL for extensions that are not configuration to use this new feature.

    Extensions.SQLite stores the data on the installed extensions, by replacing the extensions.cache and extensions.rdf files.

    You really not need the addons.sqlite file, but I do not know the ramifications to delete the content of this file and 'locking' so that it is used. Not that it stores a large amount of data; only 320kb with 30 installed extensions.

  • How to read data from an excel and HTML file

    Hello

    I write a 2D-array of string in Excel/HTML file using the generation of reports.

    Can someone tell me how to get back in return, the written data, same files again and display in table format.

    Thank you & best regards

    Visuman

    You can use activex to read data from the excel fileback to the table format... through this vi... may b this will help you...

  • Push the access and html page locally

    Hello

    I know how to make an html page.

    If I push a page called "myNews.html" store on a remote server.

    My widget on my index.html page, I have a link to the page "myNews.html".

    My problem is I want to open it locally. I don't want to open it from a remote server.

    It should not be in the cache of the browser?

    An application widget/webworks is a sandbox separate from the actual BlackBerry browser.  He does not share the cache of the browser and therefore would not be able to load in your page that is pushed by a surge in browser or the Web for the signals channel.

  • Size limits for the parameter SQLITE and file saving for the playbook

    It is partly linked to another of my posts, but isn't quite a duplcate. Thanks for bearing with me.

    Is there a size limit when passing a string as a parameter to an INSERT of SQLITE order? I get the transaction do not return not whatever it is, the error / success / otherwise, when I pass a string as a massive paremeters (> 50 KB).

    The docs for SQLITE suggest that this should not be a problem.

    As an alternative, we can save files of text in memory of the playbook, and reference them in the database. This would allow us to work around the problem?

    As always, thanks for the help.

    The answer to the question was the .substring (0,1000000) to add at the end of my chain. This gave me the output of 1000000 of characters which is ample. I'm guessing that this better prepare the string and removed something improper.

    Has had a few tries but that's it.

  • my Java Script and html do not work correctly in any other browser other than Internet Explorer

    original title: my html and Java Script do not work correctly in another browser other than Internet Explorer, which is not the only browser used with Windows. How can I fix it?
     
    -
    -
    600
    4
    6
    0 x 80000000000000
    15
    Windows PowerShell
    WIN-GRBD073PMKI

    +
    Function
    Has begun
    ProviderName = Function NewProviderState = SequenceNumber started = 5 HostName = ConsoleHost HostVersion = 2.0 HostId = 9 a 968549-639 a-4de1-9012-5b443edaae11 EngineVersion = RunspaceId = PipelineId = CommandName = CommandType = ScriptName = CommandPath = command line =.

    Hello

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums.

    http://social.msdn.Microsoft.com/forums/en-us/iewebdevelopment/threads

    I hope that helps!

  • Location of the CRG App Sqlite and explore

    Hi all

    I use Jdeveloper 12.1.3 with PSM 2.1 to build an application that uses Oracle A-team persistence accelerator to implement offline functionality.

    I'm exploring the database of lite sql that is generated once the data is stored inside.

    I used the Android DDMS tool to explore the file system. Under/data/data / < app_package > / / files, I found a .db file < AppName >. I guess it comes to the sqlite database that is used.

    However, I can not open a browser of SQLite.

    I assumed it is because it is encrypted by the MAF.

    There are two issues here:

    1 - is the actual location where the sqlite database is stored? If this isn't the case, could you please provide me with the location?

    2. is it possible to explore the contents of the database in development mode? So, lets say, turn off encryption for her, while developing?

    Kind regards

    Bogdan Zegheanu

    Hello Bogdan,

    1. Yes, it's the actual location.

    2. Yes, this is caused by encryption, and you can disable the encryption by adding the following line to mobile-persistence - config.properties:

    DB. Encryption = false

    Steven Davelaar,

    Oracle Mobile A-team.

  • Mobile on php and html

    A client asked me to make his site mobile mode without changing anything to it (the page was made in html and php). My question is: can I make the mobile version on Adobe Muse and upload it on the net? (Without changing the Web site) Thank you

    robertocooper wrote:

    A client asked me to make his site mobile mode without changing anything to it (the page was made in html & php). My question is: can I make the mobile version on Adobe Muse and upload it on the net? (Without changing the Web site) Thank you

    Sometimes if the host supports the html rules base;

    1. The redirect for phones link will point to muse/index.html
    2. The homepage of the current site is called index.html, not default.php or http://www.sigling.is/IMO/imofishing/home.htm

Maybe you are looking for

  • Can satellite A300-15j - I disable the system beep

    Hello I have a laptop Satellite A300-15j.Is there no way to disable my Bell System? It's sound is very loud and annoying.I would have run a big mysql script with errors soon and my Bell system had become crazy. My cell phone sounded like an alarm and

  • Windows 7 - kb2434419 does not install

    This update will not update indicates that I have a different flavor of windows essentials. How to make it to update, I get the thing that says that I've updated ready to date, but it never works

  • You can block e-mail from a specific sender reciving

    reciving a Junk Sender emai

  • I'm cann't print my printer LaserJet 1536 dbf MFP by Tcp/IP

    I installed the new printer laserjet (dnf MFP HP LaserJet 1536) with driver when I download from the HP Web (Full Version). When the driver installation is finished I have connected answer my printer with the mode of manual configuration of networkin

  • BlackBerry Smartphones Ringtone question

    OK, when someone calls me, my phone begins to vibrate 3 times before the start of the ring, where can I find the options to change the duration of the vibration? I know it's the same menu of options when you choose how hard your ringtone is. Thanks i