How does sqlite work with javascript in Firefox add-on? -
How can I use sqlite? When I want to use it, then what is the command:
Select from the table ? (I mean, I want to use mysql_query ("SELECT * FROM table") as PHP; ) When I get a table with the record and I want to separate this? (In PHP: mysql_fetch_assoc () or mysql_fetch_array () ) I used the table from the SELECT * table and I removed it. (The table contains these columns: id, name, pass ) How can I get column values? This is the connection to the database in JavaScript:
Components.utils.import ("resource: //gre/modules/Services.jsm"); Components.utils.import ("Resources: //gre/modules/FileUtils.jsm"); File = FileUtils.getFile ("ProfD", ["my_db_file_name.sqlite"]); Let's mDBConn = Services.storage.openDatabase (file); How do I create a table (if it does not exist), how do I SELECT , UPDATE , DELETE < / Code>, ect How can I do this with javascript and sqlite: Example (its mysql, written in PHP):
mysql_connect ("localhost" , "User", "pass"); // if mysql_select_db is required ("my_database"); MySQL_query ("create tab 'my_database` .`table` (` id` INT not pure attributement primary key,' nav 'VARCHAR (50) No,' pass 'VARCHAR (20) No, index (`nav') engine = InnoDB Include in the values ("Peter", "SDF"); $ Query = mysql_query ("Select from * Table"); while the ((table, name, pass) "HARACTER SET utf8 COLLATE utf8_unicode_ci;"; Mysql_query; $ Row = mysql_fetch_array ($ query)) {echo $ row ['name']. ''. $ Line ['pass']; // This writes all records, like 'name pass' ('Peter sdf')} $ Row2 = mysql_fetch_assoc (mysql_query ("SELECT * FROM table WHERE id = 1")); $ Points Per Line ['Name']. '' [Pass'] $ line2. '; // This is just' Peter sdf 'mysql_query ("Delete table id = 1"); Mysql_query ("Drop Table' table '' ); Mysql_close (); How can I do this with javascript in sqlite?
You should use the Mozilla Collection API to work with the SQLite database.
Comments
Post a Comment