Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 10:31
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
SQlite3 database prog in Puppy..?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Tue 11 Dec 2007, 23:11    Post_subject:  SQlite3 database prog in Puppy..?
Sub_title: How to 'set up data' in SQlite3..?
 

.
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.. Embarassed

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

Code:
su mysql
mysql_install_db


And in PosgreSQL:

Code:
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:
/usr/bin/mysqld_safe &


And PostgreSQL: (log in as postgres)
Code:
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >-/logfile 2>&1 &


So how to do this in SQlite3 - please..? Smile

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..
Back to top
View user's profile Send_private_message 
Ian
Official Dog Handler


Joined: 04 May 2005
Posts: 1237
Location: Queensland

PostPosted: Wed 12 Dec 2007, 05:31    Post_subject:  

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.
Back to top
View user's profile Send_private_message 
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Wed 12 Dec 2007, 20:35    Post_subject:  

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.. Crying or Very sad

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..
Back to top
View user's profile Send_private_message 
Ian
Official Dog Handler


Joined: 04 May 2005
Posts: 1237
Location: Queensland

PostPosted: Wed 12 Dec 2007, 21:37    Post_subject:  

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.
sqlite.tar.gz
Description 
gz

 Download 
Filename  sqlite.tar.gz 
Filesize  2.1 KB 
Downloaded  528 Time(s) 
Back to top
View user's profile Send_private_message 
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Thu 13 Dec 2007, 20:12    Post_subject:  

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..).. Laughing

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'.. Rolling Eyes

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

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..
Back to top
View user's profile Send_private_message 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 13 Dec 2007, 20:51    Post_subject:  

Quote:
(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 Smile

Mark

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Thu 13 Dec 2007, 21:25    Post_subject:  

Code:
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:
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):

Quote:
{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/readme_sqlite_tutorial.html

Mark
Back to top
View user's profile Send_private_message Visit_website 
2byte

Joined: 09 Oct 2006
Posts: 357

PostPosted: Sat 15 Dec 2007, 17:23    Post_subject:  

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/tksqlite-0.5.6-linux-ix86-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
Back to top
View user's profile Send_private_message 
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Sat 15 Dec 2007, 21:17    Post_subject:  

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.. Confused

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).. Question

I may have to just use the QT GUI tools to do what I want.. Rolling Eyes

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..
Back to top
View user's profile Send_private_message 
muggins

Joined: 20 Jan 2006
Posts: 6687
Location: lisbon

PostPosted: Sat 15 Dec 2007, 23:53    Post_subject:  

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.
Back to top
View user's profile Send_private_message 
2byte

Joined: 09 Oct 2006
Posts: 357

PostPosted: Sun 16 Dec 2007, 00:58    Post_subject:  

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.
Back to top
View user's profile Send_private_message 
Ian
Official Dog Handler


Joined: 04 May 2005
Posts: 1237
Location: Queensland

PostPosted: Sun 16 Dec 2007, 17:52    Post_subject:  

Puppy 3.0.1 still has tclsh & wish, Puppy 4.0 has them removed.
Back to top
View user's profile Send_private_message 
craftybytes


Joined: 17 Nov 2006
Posts: 298
Location: QLD AUSTRALIA

PostPosted: Sun 16 Dec 2007, 21:45    Post_subject:  

.
Thanks all for the great help.. Very Happy

Looks like tksqlite is the way to go.. Laughing

Much appreciated.. Surprised

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..
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0772s ][ Queries: 13 (0.0048s) ][ GZIP on ]