Postgres Omnis
I use Postgres too. This one line of code deletes all records from a table:
Do $ctask.tstaobj.$execdirect(‘DELETE FROM customers’)
It doesn’t need to be harder. It’s done from the statement object and you just say Delete from > On Feb 14, 2018, at 2:57 PM, Chris Hughes <ataddata@bigpond.net.au> wrote: _____________________________________________________________
>
> I am trying to delete a whole table with following command.
>
> This basic command runs in the PGAdmin window.
>
>
>
> ; pTableName
>
> ; “Truncate” is SQL for delete all records
>
> ;
>
> Do tSessionObj.$newstatement Returns LvStatementObj
>
> If isclear(LvStatementObj)
>
> Breakpoint {bug trap}
>
> End If
>
> Calculate LvSQL as con(‘TRUNCATE TABLE ‘,pTableName,’ RESTART IDENTITY;’)
>
> Do LvStatementObj.$prepare([LvSQL]) Returns LvError ;; LvStatementObj
>
> Do LvStatementObj.$execute() Returns LvError ;; LvStatementObj
>
> If LvStatementObj.$errorcode
>
> OK message Truncate Delete Failed {[LvStatementObj.$nativeerrortext]
> [LvStatementObj.$errorcode]}
>
> Quit method kFalse
>
> End If
>
> Quit method kTrue
>
>
>
>
>
>
>
> Chris Hughes
>
>
>
> Copious Data Pty Ltd (Trading as Atad Data)
>
> Unit 8 /3460 Pacific Highway
>
> Springwood QLD 4127
>
> Phone No:- 07 3208 6347
>
> Mobile No:- 0409 263 349
>
> Fax No:- 07 3208 9347
>
> Email:- ataddata@bigpond.net.au
>
> Web Site:- ataddata.com.au
>
>
>
>
>
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
>
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com