Re: TeraScript-Talk: Insert action results

2018-07-20 Thread Wayne Irvine
That’s exactly what I do at present. Before I insert I create a GUID, then 
after I search for that GUID.

Wayne

> On 21 Jul 2018, at 2:51 am, D Mark Weiss  wrote:
>
> If I understand...Years ago I was taught this technique which I am sure you 
> know already.
>
> Prior to an insert create a unique variable.
> When you make the insert save that variable into a column for that record
> Then select row ID or unique ID for that row using that same variable on that 
> column.
>
> I suppose it’s not elegant. But it really doesn’t create that much overhead I 
> don’t think
>
> Mark
>
>
>
> D Mark Weiss
> CM Harbor, LLC
> PonyTracker
> 435-363-6363
>
>> On Jul 20, 2018, at 10:16 AM, Wayne Irvine  wrote:
>>
>> <@NUMAFFECTED> returns 1
>>> On 21 Jul 2018, at 1:52 am, Robert Shubert  wrote:
>>>
>>> It may now. Check @NUMAFFECTED afterwards.
>>>
>>> This is something we're looking at supporting better in v8 with an explicit 
>>> flag to obtain the identity after insert. JDBC supports a mechanism for 
>>> doing so, but we need to explicitly invoke it.
>>>
>>> Robert
>>>
>>> -----Original Message-----
>>> From: Wayne Irvine [mailto:wa...@byteserve.com.au]
>>> Sent: Thursday, July 19, 2018 7:56 PM
>>> To: TeraScript-Talk@terascript.com
>>> Subject: Re: TeraScript-Talk: Insert action results
>>>
>>> Scratch that. Seems I asked the same question 5 years ago. The answer in 
>>> the case of FMS as a JDBC datasource is no.
>>>
>>>> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>>>>
>>>> The Search action returns @@resultset. Does the Insert action return any 
>>>> results (a row ID for example) and if so how do we access it?
>>>>
>>>> Wayne
>>>>
>>>> Byteserve Pty Ltd
>>>> w: http://www.byteserve.com.au/
>>>> e: i...@byteserve.com.au
>>>> p: +61 02 9960 6099
>>>> m: 0409 960 609
>>>> f: +61 02 9960 6088
>>>>
>>>>
>>>>
>>>>
>>>> 
>>>>
>>>> To unsubscribe from this list, please send an email to 
>>>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>>>
>>>
>>> Byteserve Pty Ltd
>>> w: http://www.byteserve.com.au/
>>> e: i...@byteserve.com.au
>>> p: +61 02 9960 6099
>>> m: 0409 960 609
>>> f: +61 02 9960 6088
>>>
>>>
>>>
>>>
>>> 
>>>
>>> To unsubscribe from this list, please send an email to 
>>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>>
>>>
>>>
>>>
>>> 
>>>
>>> To unsubscribe from this list, please send an email to 
>>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>>
>>
>> Byteserve Pty Ltd
>> w: http://www.byteserve.com.au/
>> e: i...@byteserve.com.au
>> p: +61 02 9960 6099
>> m: 0409 960 609
>> f: +61 02 9960 6088
>>
>>
>>
>>
>> 
>>
>> To unsubscribe from this list, please send an email to 
>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>

Byteserve Pty Ltd
w: http://www.byteserve.com.au/
e: i...@byteserve.com.au
p: +61 02 9960 6099
m: 0409 960 609
f: +61 02 9960 6088






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.



Re: TeraScript-Talk: Insert action results

2018-07-20 Thread D Mark Weiss
If I understand...Years ago I was taught this technique which I am sure you 
know already.

Prior to an insert create a unique variable.
When you make the insert save that variable into a column for that record
Then select row ID or unique ID for that row using that same variable on that 
column.

I suppose it’s not elegant. But it really doesn’t create that much overhead I 
don’t think

Mark



D Mark Weiss
CM Harbor, LLC
PonyTracker
435-363-6363

> On Jul 20, 2018, at 10:16 AM, Wayne Irvine  wrote:
>
> <@NUMAFFECTED> returns 1
>> On 21 Jul 2018, at 1:52 am, Robert Shubert  wrote:
>>
>> It may now. Check @NUMAFFECTED afterwards.
>>
>> This is something we're looking at supporting better in v8 with an explicit 
>> flag to obtain the identity after insert. JDBC supports a mechanism for 
>> doing so, but we need to explicitly invoke it.
>>
>> Robert
>>
>> -Original Message-
>> From: Wayne Irvine [mailto:wa...@byteserve.com.au]
>> Sent: Thursday, July 19, 2018 7:56 PM
>> To: TeraScript-Talk@terascript.com
>> Subject: Re: TeraScript-Talk: Insert action results
>>
>> Scratch that. Seems I asked the same question 5 years ago. The answer in the 
>> case of FMS as a JDBC datasource is no.
>>
>>> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>>>
>>> The Search action returns @@resultset. Does the Insert action return any 
>>> results (a row ID for example) and if so how do we access it?
>>>
>>> Wayne
>>>
>>> Byteserve Pty Ltd
>>> w: http://www.byteserve.com.au/
>>> e: i...@byteserve.com.au
>>> p: +61 02 9960 6099
>>> m: 0409 960 609
>>> f: +61 02 9960 6088
>>>
>>>
>>>
>>>
>>> 
>>>
>>> To unsubscribe from this list, please send an email to 
>>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>>
>>
>> Byteserve Pty Ltd
>> w: http://www.byteserve.com.au/
>> e: i...@byteserve.com.au
>> p: +61 02 9960 6099
>> m: 0409 960 609
>> f: +61 02 9960 6088
>>
>>
>>
>>
>> 
>>
>> To unsubscribe from this list, please send an email to 
>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>
>>
>>
>>
>> 
>>
>> To unsubscribe from this list, please send an email to 
>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>
>
> Byteserve Pty Ltd
> w: http://www.byteserve.com.au/
> e: i...@byteserve.com.au
> p: +61 02 9960 6099
> m: 0409 960 609
> f: +61 02 9960 6088
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>





To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.



RE: TeraScript-Talk: Insert action results

2018-07-20 Thread Robert Shubert
Ok, so we are getting back the fact that the insert occurred.

Usually this is done with a connection query. In SQL Server it's: SELECT 
@@identity

One way you can do it is to immediately SELECT max(id) FROM table - assuming 
that the key you want is auto incrementing. Doing this in a transaction would 
ensure you get the record you just inserted.

Another way is to select the id of the record you just inserted using the 
values as keys:

INSERT INTO table (col1, col2, col3) VALUES (123, 456, 789)

Then

SELECT id FROM table WHERE col1 = 123 AND col2 = 456 AND col3 = 789

Of course you just need to use enough columns to ensure you get the same record 
back, so if there's something unique, like a timestamp, or email address, etc. 
then you can just rely on those columns.

One of the nice things about rewriting v8 is the ability to [finally] solve 
issues like this. The v8 solution works like this:

You make an query with a "get identity" flag set (this is automatic for the 
insert action). Internally, we then do what we need to get the identity of the 
newly inserted record. Note that this can fail for certain reasons. After the 
insert, there's a new tag @IDENTITY that resolves to the newly generated key. 
No need to run an additional query or setup a transaction. TS takes care of it 
for you. I should also note that this relies on support from the DBMS and JDBC 
driver.

Robert


-Original Message-
From: Wayne Irvine [mailto:wa...@byteserve.com.au]
Sent: Friday, July 20, 2018 9:17 AM
To: TeraScript-Talk@terascript.com
Subject: Re: TeraScript-Talk: Insert action results

<@NUMAFFECTED> returns 1
> On 21 Jul 2018, at 1:52 am, Robert Shubert  wrote:
>
> It may now. Check @NUMAFFECTED afterwards.
>
> This is something we're looking at supporting better in v8 with an explicit 
> flag to obtain the identity after insert. JDBC supports a mechanism for doing 
> so, but we need to explicitly invoke it.
>
> Robert
>
> -Original Message-
> From: Wayne Irvine [mailto:wa...@byteserve.com.au]
> Sent: Thursday, July 19, 2018 7:56 PM
> To: TeraScript-Talk@terascript.com
> Subject: Re: TeraScript-Talk: Insert action results
>
> Scratch that. Seems I asked the same question 5 years ago. The answer in the 
> case of FMS as a JDBC datasource is no.
>
>> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>>
>> The Search action returns @@resultset. Does the Insert action return any 
>> results (a row ID for example) and if so how do we access it?
>>
>> Wayne
>>
>> Byteserve Pty Ltd
>> w: http://www.byteserve.com.au/
>> e: i...@byteserve.com.au
>> p: +61 02 9960 6099
>> m: 0409 960 609
>> f: +61 02 9960 6088
>>
>>
>>
>>
>> 
>>
>> To unsubscribe from this list, please send an email to 
>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>
>
> Byteserve Pty Ltd
> w: http://www.byteserve.com.au/
> e: i...@byteserve.com.au
> p: +61 02 9960 6099
> m: 0409 960 609
> f: +61 02 9960 6088
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>

Byteserve Pty Ltd
w: http://www.byteserve.com.au/
e: i...@byteserve.com.au
p: +61 02 9960 6099
m: 0409 960 609
f: +61 02 9960 6088






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.



Re: TeraScript-Talk: Insert action results

2018-07-20 Thread Wayne Irvine
<@NUMAFFECTED> returns 1
> On 21 Jul 2018, at 1:52 am, Robert Shubert  wrote:
>
> It may now. Check @NUMAFFECTED afterwards.
>
> This is something we're looking at supporting better in v8 with an explicit 
> flag to obtain the identity after insert. JDBC supports a mechanism for doing 
> so, but we need to explicitly invoke it.
>
> Robert
>
> -Original Message-
> From: Wayne Irvine [mailto:wa...@byteserve.com.au]
> Sent: Thursday, July 19, 2018 7:56 PM
> To: TeraScript-Talk@terascript.com
> Subject: Re: TeraScript-Talk: Insert action results
>
> Scratch that. Seems I asked the same question 5 years ago. The answer in the 
> case of FMS as a JDBC datasource is no.
>
>> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>>
>> The Search action returns @@resultset. Does the Insert action return any 
>> results (a row ID for example) and if so how do we access it?
>>
>> Wayne
>>
>> Byteserve Pty Ltd
>> w: http://www.byteserve.com.au/
>> e: i...@byteserve.com.au
>> p: +61 02 9960 6099
>> m: 0409 960 609
>> f: +61 02 9960 6088
>>
>>
>>
>>
>> 
>>
>> To unsubscribe from this list, please send an email to 
>> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>>
>
> Byteserve Pty Ltd
> w: http://www.byteserve.com.au/
> e: i...@byteserve.com.au
> p: +61 02 9960 6099
> m: 0409 960 609
> f: +61 02 9960 6088
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>

Byteserve Pty Ltd
w: http://www.byteserve.com.au/
e: i...@byteserve.com.au
p: +61 02 9960 6099
m: 0409 960 609
f: +61 02 9960 6088






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.



RE: TeraScript-Talk: Insert action results

2018-07-20 Thread Robert Shubert
It may now. Check @NUMAFFECTED afterwards.

This is something we're looking at supporting better in v8 with an explicit 
flag to obtain the identity after insert. JDBC supports a mechanism for doing 
so, but we need to explicitly invoke it.

Robert

-Original Message-
From: Wayne Irvine [mailto:wa...@byteserve.com.au]
Sent: Thursday, July 19, 2018 7:56 PM
To: TeraScript-Talk@terascript.com
Subject: Re: TeraScript-Talk: Insert action results

Scratch that. Seems I asked the same question 5 years ago. The answer in the 
case of FMS as a JDBC datasource is no.

> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>
> The Search action returns @@resultset. Does the Insert action return any 
> results (a row ID for example) and if so how do we access it?
>
> Wayne
>
> Byteserve Pty Ltd
> w: http://www.byteserve.com.au/
> e: i...@byteserve.com.au
> p: +61 02 9960 6099
> m: 0409 960 609
> f: +61 02 9960 6088
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>

Byteserve Pty Ltd
w: http://www.byteserve.com.au/
e: i...@byteserve.com.au
p: +61 02 9960 6099
m: 0409 960 609
f: +61 02 9960 6088






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.



Re: TeraScript-Talk: Insert action results

2018-07-19 Thread Wayne Irvine
Scratch that. Seems I asked the same question 5 years ago. The answer in the 
case of FMS as a JDBC datasource is no.

> On 20 Jul 2018, at 12:48 pm, Wayne Irvine  wrote:
>
> The Search action returns @@resultset. Does the Insert action return any 
> results (a row ID for example) and if so how do we access it?
>
> Wayne
>
> Byteserve Pty Ltd
> w: http://www.byteserve.com.au/
> e: i...@byteserve.com.au
> p: +61 02 9960 6099
> m: 0409 960 609
> f: +61 02 9960 6088
>
>
>
>
> 
>
> To unsubscribe from this list, please send an email to 
> lists...@terascript.com with "unsubscribe terascript-talk" in the body.
>

Byteserve Pty Ltd
w: http://www.byteserve.com.au/
e: i...@byteserve.com.au
p: +61 02 9960 6099
m: 0409 960 609
f: +61 02 9960 6088






To unsubscribe from this list, please send an email to lists...@terascript.com 
with "unsubscribe terascript-talk" in the body.