[ic] TO_DAYS(now())

Mike Heins interchange-users@icdevgroup.org
Mon Jul 29 17:41:01 2002


Quoting Russell Mann (tech@khouse.org):
> > Quoting Russell Mann (tech@khouse.org):
> > > Hello List,
> > >
> > > Is the sql command TO_DAYS(now()) supported in Interchange?  I
> > have a query
> > > designed like this:
> > >
> > > [query
> > > prefix=pre
> > > list=1
> > > type=list
> > > st=db
> > > sql=|
> > > SELECT * FROM table_name
> > > WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 0
> > > ORDER BY date DESC
> > > LIMIT 4
> > > |
> > > ]
> > >
> > > This is designed to get the most recent four entries from today
> > or earlier,
> > > based on the "date" field.  This works just fine by running the query
> > > straight to mySQL, and it works fine in PHP, but in Interchange
> > it produces
> > > this error:
> >
> > Then your table is not a MySQL table. Interchange GDBM tables don't
> > support SQL other than as a simple search mechanism.
> >
> > --
> > Mike Heins
> > Perusion -- Expert Interchange Consulting    http://www.perusion.com/
> > phone +1.513.523.7621      <mike@perusion.com>
> 
> It is an mySQL table, defined in dbconf/mysql/table_name.mysql just like any
> other mySQL table.  There are no GDBM or txt files in the products directory
> with the same name.  I decided to troubleshoot by removing the offending
> code and found out that it doesn't like LIMIT commands either.

Step back. I am telling you authoritatively that it is being seen as a
non-SQL table.

Your ProductsFile[0] must be a GDBM table, and you need to add
table=table_name to your query tag, i.e.

   [query
	list=1
	table=table_name
	sql=" ... "]

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

I don't want to get to the end of my life and find I have just
lived the length of it. I want to have lived the width of it as
well. -- Diane Ackerman