On 2014-02-06 19:17, Michel Talon wrote:
> 
> Le 6 févr. 2014 à 13:27, Julian H. Stacey a écrit :
> 
>>>
>>> you =
>>> have to spend a couple of minutes
>>> learning the basic SQL queries, which is no more difficult that learning =
>>> obtuse find and grep options.
>>
>> Package addicts were so myopic they ignored some people won't even
>> use packages, just /usr/ports & make.  local.sqlite was immaturely
>> shoved in without documenting it, no "man 5 local.sqlite" no hook
>> there for the "couple of minutes learning" you assert, (no hook to believe
>> the "couple" you assert).
> 
> First please excuse me, this message is posted via an Apple mail system. So
> how to interact with local.sqlite?
> 
> niobe% sqlite3 local.sqlite 
> SQLite version 3.8.2 2013-12-06 14:53:30
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> .tables
> annotation           options              pkg_script         
> categories           packages             pkg_shlibs         
> deps                 pkg_annotation       pkg_shlibs_provided
> directories          pkg_categories       pkg_shlibs_required
> files                pkg_directories      pkg_users          
> groups               pkg_groups           script             
> licenses             pkg_licenses         scripts            
> mtree                pkg_option           shlibs             
> option               pkg_option_default   users              
> option_desc          pkg_option_desc    
> 
> sqlite> .schema packages
> CREATE TABLE packages (id INTEGER PRIMARY KEY,origin TEXT UNIQUE NOT 
> NULL,name TEXT NOT NULL,version TEXT NOT NULL,comment TEXT NOT NULL,desc TEXT 
> NOT NULL,mtree_id INTEGER REFERENCES mtree(id) ON DELETE RESTRICT ON UPDATE 
> CASCADE,message TEXT,arch TEXT NOT NULL,maintainer TEXT NOT NULL, www 
> TEXT,prefix TEXT NOT NULL,flatsize INTEGER NOT NULL,automatic INTEGER NOT 
> NULL,locked INTEGER NOT NULL DEFAULT 0,licenselogic INTEGER NOT NULL,time 
> INTEGER, manifestdigest TEXT NULL, pkg_format_version INTEGER);
> CREATE INDEX pkg_digest_id ON packages(origin, manifestdigest);
> 
> 
> sqlite> select name,version from packages limit 10;
> pkg|1.2.5
> xproto|7.0.25
> xextproto|7.2.1
> xbitmaps|1.1.1
> renderproto|0.11.1
> libXdmcp|1.1.1
> libXau|1.0.8
> libxml2|2.8.0_3
> libpthread-stubs|0.3_4
> kbproto|1.0.6
> 
> and to replace grepping
> 
> sqlite> select name,version from packages where name like '%kde%' limit 10;
> kdehier4|1.1.1_1
> kde4-wallpapers-freebsd|1.0
> pam_kde|1.0
> kde4-xdg-env|1.0.1
> kde4-icons-oxygen|4.10.5
> kde4-shared-mime-info|1.2
> kdelibs|4.10.5_2
> kde-wallpapers|4.10.5
> kde-base-artwork|4.10.5
> polkit-kde|0.99.1
> 
> 
> sqlite> .quit
> niobe% 
> 
> From this it is easy to experiment, and  the full sqlite documentation is at:
> 
> http://www.sqlite.org/lang.html
> 
> 
> 
> --
> 
> Michel Talon
> ta...@lpthe.jussieu.fr

Before someone complains Michel's examples requires sqlite on the system,
it even works without this way.

$ pkg shell
> select name,version from packages limit 10;
or
$ echo 'select name,version from packages limit 10;' | pkg shell

-- 
olli
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to