[comp.sys.next] NetInfo meets Sybase

lane@sumex-aim.stanford.edu (Christopher Lane) (02/10/90)

I've put the file netinfo2sybase.tar.Z on the submissions directory of the
cs.orst.edu NeXT archive--it should show up on 'sources' or some directory
eventually.

This file contains a 'csh' script that uses the NeXT utility 'niutil' to
generate a Sybase SQL script that creates tables containing the contents of
NetInfo's database.  The script makes no assumptions about the contents of the
NetInfo database, all the paths become tables and all property values are
defined as long variable length strings.

There is also included a less generic, Sybase SQL script that rebuilds several
of the tables (after the fact) to make user id's small integers instead of
strings, etc.  There is also a README(.rtf) file that goes into (only)
slightly more detail.

Once you reformat your NetInfo database into Sybase, you can generate
wonderful tables like those MIS managers you've been so envious of have been
generating for years ;-), eg:

1> select * from users where gid = uid
2> go

 name    passwd        uid   gid   realname     home            shell

 ------- ------------- ----- ----- ------------ --------------- ------------
 nobody  *             32767 32767 /dev/null    /tmp            /bin/noshell
 sync    *             32767 32767 NULL         /               /bin/sync
 daemon  *                 1     1 NULL         /               NULL
 sys     *                 2     2 NULL         /               /bin/csh
 bin     *                 3     3 NULL         /bin            NULL
 uucp    *                 4     4 NULL         /usr/spool/uucp /usr/lib/uucp
 news    *                 6     6 NULL         /usr/spool/news /bin/csh
 sybase  Oy8LhokN7KDqg     7     7 Sybase Admin /usr/sybase     /bin/csh

[Output has been cleaned up for example purposes, actual results may vary]

These scripts are preliminary, please Email me any fixes, optimizations,
interesting rules, indexes, views, triggers, etc. to include with future
releases.

Now all we have to do is rewrite gethostbyaddr, getpwent, etc. in terms of
Sybase rather than NetInfo or YellowPages and we can have a 'real' database
behind all the queries!

- Christopher

PS: Cleary, to do this 'right' you should go directly from the C library
interface into NetInfo to the C library interface into Sybase rather than
using the slow, limited 'csh' script.  However, one does have to determine if
such a conversion is worthwhile before investing the effort!
-------