D.3. A tbl2filed Example

Let's look at a complete example by continuing with the nameserver configuration for Laddie. The /etc/resolv.conf file on a running Laddie system looks like this:

nameserver 204.117.214.10
nameserver 199.2.252.10
nameserver 65.173.40.10

Our goal is to be able to read the first DNS nameserver with a SELECT statement as follows:

psql -h localhost -p 8885
> SELECT * FROM tbl2field where name = "nameserver_1";
> \q

Similarly, to modify the second DNS server, Laddie uses the following UPDATE statement:

psql -h localhost -p 8885
> UPDATE tbl2field SET value="192.168.1.1"
>   WHERE name=resolv AND field="nameserver_2";
> \q

You can verify the above by booting the Laddie CD, exiting from the framebuffer menu, logging in as root, ...

Get Linux Appliance Design now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.