MERGE function/method in MariaDB (SOLVED)

MERGE function/method in MariaDB (SOLVED)

Postby fraxzi » Wed May 16, 2018 5:19 am

Hi All,

I'm new to MariaDB. Is there a similar MERGE (update/insert) in MariaDB Class or similar?
Last edited by fraxzi on Wed May 16, 2018 6:33 am, edited 1 time in total.
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: MERGE function/method in MariaDB

Postby Marc Vanzegbroeck » Wed May 16, 2018 6:02 am

Frances,

Do you mean the update query?
https://dev.mysql.com/doc/refman/8.0/en/update.html
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: MERGE function/method in MariaDB

Postby fraxzi » Wed May 16, 2018 6:08 am

Marc Vanzegbroeck wrote:Frances,

Do you mean the update query?
https://dev.mysql.com/doc/refman/8.0/en/update.html



Hi Marc,

In ADS there is MERGE where it insert a record if not exist then update it if exists.
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: MERGE function/method in MariaDB

Postby fraxzi » Wed May 16, 2018 6:31 am

Hi All,

I think I found it... :)

https://mariadb.com/kb/en/library/insert-on-duplicate-key-update/

I will try this sooner.. :)
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: MERGE function/method in MariaDB (SOLVED)

Postby nageswaragunupudi » Wed May 16, 2018 7:35 am

All this is simpler if you use FWH Maria DB

Code: Select all  Expand view  RUN

oCn:Insert( <ctable>, <fieldlist>, <aValues>, .T. ) // last param .T.
 

If the last param is .T., this will update in case of duplicate or insert if it is not duplicate.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: MERGE function/method in MariaDB (SOLVED)

Postby fraxzi » Wed May 16, 2018 8:20 am

nageswaragunupudi wrote:All this is simpler if you use FWH Maria DB

Code: Select all  Expand view  RUN

oCn:Insert( <ctable>, <fieldlist>, <aValues>, .T. ) // last param .T.
 

If the last param is .T., this will update in case of duplicate or insert if it is not duplicate.



Hi Mr. Rao,

This is much better! :D

Thanks,
Frances
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 20 guests