SQlite3 database prog in Puppy..?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

SQlite3 database prog in Puppy..?

#1 Post by craftybytes »

.
Am looking at using Puppy's SQlite3 database for a small project but am stumped at the code for how to set up for data in the database.. :oops:

In MySQL (log on as root) - it would be something like:

Code: Select all

su mysql
mysql_install_db
And in PosgreSQL:

Code: Select all

useradd -d /home/postgres postgres
mkdir /home/postgres
chown postgres home/postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
To log in to the database:

MySQL: (log in as mysql)

Code: Select all

/usr/bin/mysqld_safe &
And PostgreSQL: (log in as postgres)

Code: Select all

/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >-/logfile 2>&1 &
So how to do this in SQlite3 - please..? :)

Any help would be much appreciated..

crafty.
.
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#2 Post by Ian »

What are you trying to set up exactly.

I can give you the code to set up databases & tables as I used Sqlite originaly in Puppy Money.

User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

#3 Post by craftybytes »

Hi Ian,

Actually what I'm trying to suss out is - I'm looking at Gambas to wack up a simple GUI for access to an SQlite3 database - have examples for MySQL & PostgreSQL - but none for SQlite.. :cry:

So to try and sort it - I thought of asking on this forum for possible guidance.. :wink:

Thanks for any help..

crafty.
.
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#4 Post by Ian »

All great minds think alike. I am trying to do the same with sqlite using tcl/TK, Xlibs and Perl/TK for a start.

The attachment contains the basic commands.
Attachments
sqlite.tar.gz
(2.1 KiB) Downloaded 776 times

User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

#5 Post by craftybytes »

Thanks Ian.. :wink:

I don't know about 'great minds' - I'm certain that mine is still trying to remember where it was yesterday..(ha..ha..ha..).. :lol:

With using Gambas to make the GUI - I wanted to keep possible dependencies to as low as necessary - thus just Gambas - (hopefully it can use Puppy's in-built Basic as a base to work with..) - I see you've got 'tcl/TK, Xlibs and Perl/TK'.. :roll:

Anyway - will look at what you've put in the attachment and see if it will be helpful.. 8)

TIA..

crafty.
.
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

(hopefully it can use Puppy's in-built Basic as a base to work with..)
No, certainly 100% incompatible.
Gambas is a QT application (KDE base-library).
Puppybasic = commandline only.
GtkBasic = Puppybasic with Gtk2 bindings.

I had no closer look at Gambas yet, but could imagine that it uses a completely different model concerning the mainloop.
GtkBasic runs 2 parallel threads, that just share a memory-segment, but apart from that are 2 different applications (the Gtk C mainloop and the Basic interpreter).
This is even very different to wxBasic, that Puppybasic derives from.
That used a "blocking" model without threads, where the grafical interface was a "part" of the interpreter.

The approach GtkBasic uses has some advantages, but makes it incompatible with others.

For GtkBasic, you can use Glade to create the grafical interface.
Install Glade with Petget, then you can start it from the GtkBasic-Ide for your current project :)

Mark
Last edited by MU on Fri 14 Dec 2007, 01:34, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#7 Post by MU »

Code: Select all

xwin_system(" sqlite3 MUtest.db  \"create table t1 (t1key INTEGER PRIMARY KEY,data TEXT,num double,timeEnter DATE);\"")

xwin_system(" sqlite3 MUtest.db \"insert into t1 (data,num) values ('This is sample data',3);\"")
result = xwin_system(" sqlite3 MUtest.db \"select * from t1\";")

print result
result is a GtkBasic list, so you now could iterate through it with

Code: Select all

for each theline in result
...
next
The ... had to be replaced with things that make sense, e.g. you could add these values to a clist to display them in a window (see clist demo).

The first code above will print this if run as a GtkBasic program from a consolewindow or the Ide (that opens a consolewindow for debugging-purposes):
{0:"1|This is sample data|3.0|
", 1:"2|This is sample data|3.0|
"}
I ran the simple program twice, so it shows 2 lines.

I have no experience with sqlite, just grabbed some commands from here:
http://souptonuts.sourceforge.net/readm ... orial.html

Mark

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#8 Post by 2byte »

Hi crafty,

May I suggest TKSqlite for building the database? http://reddog.s35.xrea.com/wiki/TkSQLite.html
I use the single file binary, it has no other dependencies. http://reddog.s35.xrea.com/software/tks ... bin.tar.gz

Gambas2 has two decent sqlite3 database examples, PictureDatabase and Database. The first one is simple and might be adaptable for your needs. The second one uses data-bound gtk widgets if you like that sort of thing.

Vern

User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

#9 Post by craftybytes »

Thanks guys - will look into it..!!

2byte -

Am d'ling the TKSqlite binary at the moment - will try it - BUT for my small project was trying to keep it as simple as I could for the GUI part - thus hoping that Gambas2 would make an 'stand-alone' executable GUI to use with SQlite3 databases.. :?

As BK has removed TK/Tcl from the version 3.xx/4.xx Puppies (can be put in as dotpets however) - was hoping to come up with a more general GUI that would work in v2.xx/3.xx & v4.xx puppies (if this is possible).. :?:

I may have to just use the QT GUI tools to do what I want.. :roll:

Anyway - will see what develops.. :wink:

crafty.
.
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#10 Post by muggins »

Crafty,

I don't know if this is relevant to your quest, but the tksqlite binary, recommended by 2byte, doesn't require an external tcl/tk environment, as it contains it's own internal tcl/tk structure, plus sqlite, plus any tcl files required for it to run, so it should work on any puppy version.

2byte
Posts: 353
Joined: Mon 09 Oct 2006, 18:10

#11 Post by 2byte »

Right, tksqlite makes it super easy to build and test the database, tables, and sql that you might need for your program. You can do it all with gambas if you prefer. Tksqlite will output the sql used for the create table statements too, and that can be real handy if you want to recreate the database with your gambas program code.

User avatar
Ian
Official Dog Handler
Posts: 1234
Joined: Wed 04 May 2005, 12:00
Location: Queensland

#12 Post by Ian »

Puppy 3.0.1 still has tclsh & wish, Puppy 4.0 has them removed.

User avatar
craftybytes
Posts: 298
Joined: Fri 17 Nov 2006, 10:32
Location: QLD AUSTRALIA

#13 Post by craftybytes »

.
Thanks all for the great help.. :D

Looks like tksqlite is the way to go.. :lol:

Much appreciated.. :o

Cheers.

crafty.
.
3 x boot:- ASROCK VIA 'all-in-one' m/b; AMD Duron 1.8Ghz+; 1.0GB RAM; 20GB hdd (WinXP Pro); 80GB hdd (MEPIS 3.4-3/Puppy v2.15CE Frugal); 1GB USB pendrive (Puppy 2.15CE Frugal); CD/DVDRW; 17" LCD monitor; HSF 56k modem... MEPIS is great.. Puppy ROCKS..

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

Hi, DB fans!

First do a thorough vacuuming on this 11 years old thread! ;) :lol:
But since this sqlite3 thread already existed, there was no need for me
to create a new one!

Just out, version 3.25.2 of sqlite (which includes the sqlite3 executable
that all new Puppies have), available from
https://www.sqlite.org/download.html

I tested briefly the Linux ready-made executables at
https://www.sqlite.org/2018/sqlite-tool ... 250200.zip
and they work fine on my xenialPup-7.0.6. YMMV.

Simply unzip in /usr/bin and make them executable.

Essential docs -- if you are serious about working with sqlite3 -- are
available on the same page.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply