[ic] Import THEN Data or Query Insert failure
Mike Heins
interchange-users@icdevgroup.org
Thu May 1 09:02: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.
I tried this both on Postgres and MySQL, no problem.
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
"Laughter is inner jogging." -- Norman Cousins