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

Felix felixc@jet.es
Wed, 13 Dec 2000 10:02:40 +0100


> [query sql="SELECT * FROM arbitrary"]

If you don't add the list=1 the query will be made,
but no actions taken, in minivend, it's good for
querys that don't return data.

Try:

[query list=1 sql="SELECT * FROM arbitrary"]
  [sql-code]<BR>
[/query]

([sql-code] is the first parameter of the query)

Or:

[query list=1 sql="SELECT a, b FROM arbitrary"]
  [sql-param a] [sql-param b]<BR>
[/query]

([sql-code] = [sql-param a])

Also:

[query sql="CREATE TABLE arbitrary ( id INT PRIMARY KEY, comment
VARCHAR(128));"]
[/query]

(You don't need list=1 here)

Saludos, Fèlix (Felix in 7bits)


> 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.
>
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@www.minivend.com
> http://www.minivend.com/mailman/listinfo/interchange-users
>