SQLite – simple use in scripts

2010-08-21 1 min read Database Linux

Today we will look a the most simple use’s in the scripts and how to use them.

echo ”insert into bills values (”$name”,$date_now, $date_now,$1)”|sqlite bills

or the other way to do this is

<a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">sqlite3 bills &#8221;insert into bills values (&#8221;$name&#8221;,$date_now, $date_now,$1)&#8221;

OK, now in the next post we will see a simple application that I am currently developing or planning.<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://tobu.lightbird.net/">Tobu Tutorial (tobu.lightbird.net) <li class="zemanta-article-ul-li"><a href="http://go.theregister.com/feed/www.theregister.co.uk/2010/07/02/openoffice_adopts_gstreamer/">OpenOffice gets Ubuntu-media friendly (go.theregister.com) <li class="zemanta-article-ul-li"><a href="http://elegantcode.com/2010/07/02/using-transactionscope-with-sqlite/">Using TransactionScope with SQLite (elegantcode.com) <li class="zemanta-article-ul-li"><a href="http://www.slideshare.net/aikisteve/flash-and-the-city-2010">Flash And The City 2010 (slideshare.net) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/zemified_e.png?x-id=7b7c893c-d92b-44bc-8923-d7c6fddc8b42" alt="Enhanced by Zemanta" /><span class="zem-script more-related pretty-attribution">

Continue reading

SQLite : Manager for this simple database

2010-08-19 2 min read Database Linux

We will look at sqliteman – <a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">SQLite Database manager.

If you are looking for a tool for tuning <a class="zem_slink" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL statements, manage tables, views, or triggers, administrate the <a class="zem_slink" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database space and index <a class="zem_slink" title="Statistics" rel="wikipedia" href="http://en.wikipedia.org/wiki/Statistics">statistics then Sqliteman is the perfect choice.
If you are looking for a <a class="zem_slink" title="Graphical user interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Graphical_user_interface">graphical queries creation wizards, <a class="zem_slink" title="User interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/User_interface">user interface designers for your database, or an universal report tool try the applications designed for tasks such this (<a class="zem_slink" title="Kexi" rel="homepage" href="http://kexi-project.org/">Kexi, knoda).

Continue reading

SQLite – Easy to use, dependable and good to use database for small applications.

2010-08-17 2 min read Database Linux

For last couple of days I am looking at <a class="zem_slink" title="SQLite" rel="homepage" href="http://sqlite.org/">SQLite, a very footprint, file based Database.

SQLite is a C <a class="zem_slink" title="Library (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Library_%28computing%29">library that implements an <a class="zem_slink" title="SQL" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL">SQL database <a class="zem_slink" title="Database engine" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database_engine">engine. A large subset of <a class="zem_slink" title="SQL-92" rel="wikipedia" href="http://en.wikipedia.org/wiki/SQL-92">SQL92 is supported. A complete <a class="zem_slink" title="Database" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database">database is stored in a single disk file. The <a class="zem_slink" title="Application programming interface" rel="wikipedia" href="http://en.wikipedia.org/wiki/Application_programming_interface">API is designed for convenience and ease of use. Applications that link against SQLite can enjoy the power and flexibility of an SQL database without the administrative hassles of supporting a separate <a class="zem_slink" title="Database server" rel="wikipedia" href="http://en.wikipedia.org/wiki/Database_server">database server. Version 2 and version 3 binaries are named to permit each to be installed on a single <a class="zem_slink" title="Server (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Server_%28computing%29">host.

Continue reading

MySQL tutorial and reference manual

2010-06-25 1 min read Database Linux

The refence for the mysql could be found at

<a class="aligncenter" title="MySQL Help" href="http://http://dev.mysql.com/doc/refman/5.0/en/index.html" target="_blank">MySQL Help

Using PHP to search a MySQL database and return paged results

2010-06-25 1 min read Database Linux

<a href="http://www.designplace.org/scripts.php?page=1amp;c_id=25">Using PHP to search a MySQL database and return paged results

Link above to the article. I am using this as base to do some programming of my own for my website. When I am done I can post few more details, till then…………

bash script with sql to get the number of records from multiple tables.

2010-02-10 1 min read Bash Database Learning Linux Solaris

Here is the bash script:

#!/bin/sh
names[1]=errorlog
names[2]=amit1log
names[3]=amit2log
names[4]=amit3log
names[5]=amit4log
j=1
echo $1
for i in $( sqlplus amit/passwd@tns @get_count.sql |sed  -n &#8217;/COUNT/,/Disconnected/p&#8217;|sed &#8217;/COUNT/ d&#8217;|sed &#8217;/—/ d&#8217;|sed &#8217;/Disconnected/ d&#8217;|tr &#8217;n&#8217; &#8217; &#8217;  )
do
temp=${names[$j]}
let count=30-${#temp}
for ((I=1; I <= $count ; I++))
do
printf &#8221; &#8221;
done
echo  &#8221;${names[$j]}    : $i&#8221;
# echo $j
let j=j+1
done
echo
echo

and the required sql script:

select count() from errorlog;
select count(
) from amit1log;
select count() from amit2log;
select count(
) from amit3log;
select count(*) from amit4log;
quit;

Continue reading

Execute mysql command from shell

2010-02-04 1 min read Database

phpMyAdmin is a very slow application if you want to execute a query on your database. If you know the name of the database then any GUI tool is an overhead. So I have written a one liner shell script to do that for me 🙂

Here&#8217;s the script:

echo &#8221;select * from table where field like &#8221;%$1%&#8221;&#8221;|mysql -h doamin.com -u amit -p -D amit -r –password=hello

When run with one argument it will execute the sql query directly without asking for password also.

Continue reading
Older posts Newer posts