[ic] Unable to write to MySQL table

Mike Heins mike at perusion.com
Sat Nov 22 22:40:27 EST 2003


Quoting Stefan Hornburg (Racke) (racke at linuxia.de):
> On Sat, 22 Nov 2003 14:53:45 -0500
> Interchange User <interchange at framework.cx> wrote:
> 
> > >> 	I have a table that I am unable to write to using the Admin UI.  I  
> > >> can
> > >> read it just fine, and I know the MySQL account I am using has full
> > >> access to the tables.  I get the following in the logs:
> > >>
> > >> ---------------------------------------------------------------------- 
> > >> --
> > >> 192.168.0.100 gKjyC9oq:192.168.0.100 - [22/November/2003:07:49:50
> > >> -0500] n /cgi-bin/n/admin/flex_editor No key 'id' found for
> > >> function='update' table='wish_list'
> > >> ---------------------------------------------------------------------- 
> > >> --
> > >
> > > You can most likely make the problem go away be renaming your primary  
> > > key
> > > to be something other than "id". The reason this is a problem is that  
> > > the
> > > table editor is passing the "id" parameter via CGI, and "id" is an  
> > > alias
> > > in Interchange for "mv_session_id".
> > >
> > > Many two-character names have such an alias. See $ICROOT/etc/varnames  
> > > for
> > > a complete list. You should be able to remove the mv_session_id = id
> > > mapping to fix the problem too, but if you have the chance to change  
> > > the
> > > primary key name it'll probably make life easier for you to do it that
> > > way.
> > >
> > > Jon
> > 
> > Renaming my id column to code did the trick!  Kind of a pain, as id has  
> > been my MySQL standard for the last 4 years, but there you go.  :)
> 
> I moved to idf for the same reason :-)

Gee, if people would have told me I would have provided a mapping
thing to translate field names in the data editor...in fact, we
could have easily set a switch which had the table-editor rename the
fields to mv_data_field_id and have Vend::Data::update_data field that.

Also, you could easily do in etc/varnames 

	mv_session_id   sid

or in interchange.cfg

	VarName  mv_session_id  sid

and get rid of the problem. I thought mv_session_id was too verbose to
put in every URL, and I wasn't in the habit of using "id" because of the
original Vend choice of "code" for the standard key name.

In the end I sort of coopted all of the two-letter variable names, which
means your data field names need to be three chars long (and not begin
with mv_) to be relatively safe.

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

Any man who is under 30, and is not liberal, has not heart; and any man
who is over 30, and is not a conservative, has not brains.
 -- Winston Churchill


More information about the interchange-users mailing list