[ic] Proper method of creating new tables to be used by IC

Dan db@cyclonehq.dnsalias.net
Wed, 13 Dec 2000 00:29:03 -0800


RH6.2, IC 4.6.1 (release), Pgsql 7.0.3

I'm having great successes using IC and pgsql, but I'm confused about adding
new tables to the database I'm using.  I've read, reread, and grokked the
documentation, including "3.1. SQL Support via DBI", yet I cannot figure out
what the correct method for adding new tables or modifying exising table
columns is.  (Documentation didn't have enough baby steps for me, I guess).

Though I can't get SQL access to work, I am able to create arbitrary.txt
databases and search them just fine, but how do I create and access my SQL
tables?  Here's what I have tried:

1. Create the SQL table and populate it...
(from psql)
DROP TABLE arbitrary;
CREATE TABLE arbitrary ( id INT PRIMARY KEY, comment VARCHAR(128));
COPY arbitrary FROM '/tmp/arbitrary.csv' USING DELIMITERS ',';

2. touch CATALOG_DIR/products/arbitrary.sql
3. try to access it from in-page searches, such as:
[loop search="
 st=db
 fi=arbitrary
 se=2
 sf=id
 rf=comment
 "]
 [loop-comment]
[/loop]

or -

[loop search="sq=select * from arbitrary"] [loop-comment] [/loop]

or -

[query sql="SELECT * FROM arbitrary"]

4. But the searches don't return anything to the pages.  They don't even
leave errors in error.log.  Except when I get into dbconf/ and make a
dbconf/pgsql/arbitrary.pgsql, with all the correct info, such as:

# Interchange database definition
Database  arbitrary       __SQLDSN__
#ifdef SQLUSER
Database  arbitrary  USER         __SQLUSER__
#endif
#ifdef SQLPASS
Database  arbitrary  PASS         __SQLPASS__
#endif
Database  arbitrary  KEY          id
Database  arbitrary  COLUMN_DEF   "id=INT PRIMARY KEY"
Database  arbitrary  COLUMN_DEF   "comment=VARCHAR(128)"
Database  coverage  ChopBlanks   1

Then, when I try the search code I get:

10.0.0.103 zhTsGuTr:10.0.0.103 - [12/December/2000:23:18:32 -0800] ds25
/cgi-bin/ds25/process.html Runtime error: Cannot open database text source
file /var/ic/ds25/products/dbi:Pg:dbname=ds: No such file or directory

or-

10.0.0.103 zhTsGuTr:10.0.0.103 - [13/December/2000:00:06:02 -0800] ds25
/cgi-bin/ds25/process.html search error: your search file a valid database
reference, was 'dbi:Pg:dbname=ds'.

What I'm really thinking is:  there are lots of people out there adding new
tables and columns on their SQL databases, and accessing them all the time.
What are the baby steps to doing it on a construct template with 4.6.1 and
pgsql?

Thanks.  If no one answers, I'll record a .mpg of my ignorant problem and
put it on geocities or something, and then spam the URL to usenet hoping
someone will see the link and know interchange at the same time.

Dan Browning - danb@cyclonecomputers.com

PS. I was kidding about the spamming part.