{"id":417,"date":"2020-08-04T08:08:57","date_gmt":"2020-08-04T08:08:57","guid":{"rendered":"https:\/\/silviamarin.ro\/?p=417"},"modified":"2020-08-04T08:08:57","modified_gmt":"2020-08-04T08:08:57","slug":"instalare-sqlite","status":"publish","type":"post","link":"https:\/\/marinelvis.xyz\/index.php\/2020\/08\/04\/instalare-sqlite\/","title":{"rendered":"INSTALARE SQLite"},"content":{"rendered":"<pre>apt update\napt-get install sqlite3<\/pre>\n<p>Se creeaza bazele de date cu tabelele corespunzatoare:<br \/>\nPentru NVR POARTA, CURTE si HOL se creeaza bazele de date <em>poarta.db, curte.db si hol.db<\/em>:<\/p>\n<pre>sqlite3 \/mnt\/DIVERSE\/CAM\/poarta.db\nsqlite3 \/mnt\/DIVERSE\/CAM\/curte.db\nsqlite3 \/mnt\/DIVERSE\/CAM\/hol.db<\/pre>\n<p>In SQLite, in fiecare baza de date se \u00a0se creeaza tabelul <em>nvr<\/em>:<\/p>\n<pre>CREATE TABLE 'nvr' ('id' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'type' TEXT NOT NULL, 'path' TEXT, 'filename' TEXT, 'epoch' INTEGER, 'timestamp' INTEGER DEFAULT CURRENT_TIMESTAMP, 'wwwpath' TEXT);\n.quit<\/pre>\n<p>Pentru TEMPERATURI se creeaza baza de date <em>temperaturi.db<\/em> cu tabelele t<em>empDORMITOR, tempHOL, tempMIHAI, tempBUCATARIE:<\/em><\/p>\n<pre>sqlite3 \/mnt\/DIVERSE\/CAM\/temperaturi.db\nCREATE TABLE tempDORMITOR(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Data TEXT NOT NULL, Temperatura REAL NOT NULL, Umiditate REAL NOT NULL, Baterie INTEGER NOT NULL);\n.quit<\/pre>\n<p>Pentru ENERGIE se creeaza baza de date <em>energie.db<\/em> cu tabelele<em> energiePOW2, energiePOW3:<\/em><\/p>\n<pre>sqlite3 \/mnt\/DIVERSE\/CAM\/energie.db\nCREATE TABLE energiePOW2(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Data TEXT NOT NULL, Ieri REAL NOT NULL, Azi REAL NOT NULL, Total INTEGER NOT NULL, Tensiune INTEGER NOT NULL);\nCREATE TABLE energiePOW3(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, Data TEXT NOT NULL, Ieri REAL NOT NULL, Azi REAL NOT NULL, Total INTEGER NOT NULL, Tensiune INTEGER NOT NULL);\n.quit<\/pre>\n<p><strong>COMENZI SQLite:<\/strong><br \/>\nSterge toate inregistrarile din tabelul <em>tempDORMITOR:<\/em><\/p>\n<pre>DELETE FROM tempDORMITOR;<\/pre>\n<p>Arata toate primele 100 de intrari din tabelul <em>tempDORMITOR:<\/em><\/p>\n<pre>SELECT * FROM tempDORMITOR ORDER BY Data ASC LIMIT 100;<\/pre>\n<p>Reseteaza indexul in tabelul <em>tempDORMITOR<\/em> (dupa ce au fost sterse inregistrarile):<\/p>\n<pre>UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='tempDORMITOR';<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>apt update apt-get install sqlite3 Se creeaza bazele de date cu tabelele corespunzatoare: Pentru NVR POARTA, CURTE si HOL se creeaza bazele de date poarta.db, curte.db si hol.db: sqlite3 \/mnt\/DIVERSE\/CAM\/poarta.db sqlite3 \/mnt\/DIVERSE\/CAM\/curte.db sqlite3 \/mnt\/DIVERSE\/CAM\/hol.db In SQLite, in fiecare baza de date se \u00a0se creeaza tabelul nvr: CREATE TABLE &#8216;nvr&#8217; (&#8216;id&#8217; INTEGER PRIMARY KEY AUTOINCREMENT NOT [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-417","post","type-post","status-publish","format-standard","hentry","category-fara-categorie"],"_links":{"self":[{"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/posts\/417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=417"}],"version-history":[{"count":0,"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/posts\/417\/revisions"}],"wp:attachment":[{"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/marinelvis.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}