[ic] Import THEN Data or Query Insert failure

Paul Jordan interchange-users@icdevgroup.org
Fri May 2 13:51:00 2003


> Quoting Paul Jordan (paul@gishnetwork.com):
> >
> > Hello fellas
> >
> > I ran into something weird. I have an [import ....].....[/import] on a page,
> > I also have another insert on the same page, for the same table. The Import
> > works. However for some reason if I try an insert BELOW it, the insert will
> > fail. I tried both with a [query] and [data] type inserts. Both failed with
> > error log saying...
> >
> >   Attempt to write read-only table.....
> >
> > The weird part, upon investigating, either the [data] or
> > [query] insert WILL work just above the [import].
> >
> > It seems to me that maybe the [import]... after it is done, puts some sort
> > of permanent lock on said table, for the rest of the page.
> >
> > I have tried all different ways with varying usages of mv_data_enable and
> > [flag type="write"...] tags. It always comes down to working above, but not
> > below. I ofcourse am just gonna do the write above it, but it was bothering
> > me... Has anyone else experienced this before? To be clear, the [import]
> > never fails throughout this...
>
> Cannot duplicate this. It all works fine for me, using essentially
> the same code.
>
> [import table=inventory type=LINE continue=NOTES]
> sku: os22226
> quantity: 26
> stock_message: Message
> [/import]
>
> [flag type=write table=inventory]
> [data table=inventory col=account key=os22226 value=foo_account]
>
> [flag type=write table=inventory]
> [query sql="update inventory set cogs_account = 'bar_account'
> where sku = 'os22226'"][/query]
>
> <XMP>
> [query sql="select * from inventory where sku = 'os22226'"
> list=1][sql-line][/query]
> </XMP>
>
> This yields:
>
> 1 foo_account 1
>
> sku	quantity	stock_message	account	cogs_account
> min_order
> os22226	26	Message	foo_account	bar_account
>
> The extra write flags are not necessary, by the way.

Yes, I only tried "each" not "both" I included both for completeness.

It seems to have come down to

	WRITE_CONTROL  1
	WRITE_TAGGED   1

The person who originally designed this particular table (ahem, ahem) placed the
above two parameters on it, which I never have used before. After reading the
docs about them, it seems that my scenario should have still worked though. It
also appears that it is not necessarily an [import] coupled with an INSERT, as I
ran into this again with a [query] SELECT and [query] INSERT on the same table.
That's is when it dawned on me that this is a table issue, and not syntax or
order issue.

I cannot:
	two query inserts (or updates)
	an import THEN query insert
	a query select THEN query insert

I can:
	two query selects
	query insert THEN [import]

This seems like are pretty obscure issue. If this is of interest I will keep
testing. It may just be a poor understanding of the above mentioned parameters
on my part.

I have removed the above mentioned params, so it is the default for MYSQL now,
and works. It seems like [flag]ing should have remedied this though.

Paul