Llenar campo con MariaDB

Llenar campo con MariaDB

Postby acuellar » Mon Feb 25, 2019 9:35 pm

Estimados

Como llenar un campo sin recorrer toda la tabla MariaDB igual a un REPLACE ALL de DBF

De ésta forma tarda:
Code: Select all  Expand view  RUN

 oSQL:Gotop()
  Do While !oSQL:Eof()
    oSQL:EXT:='123';oSQL:Save() //oSQL:Update()
    oSQL:Skip()
  Enddo
 
 


Gracias por la ayuda
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Postby cmsoft » Mon Feb 25, 2019 11:49 pm

Hola Adhemar:
Con un execute en lugar de llenar registro por registro
Code: Select all  Expand view  RUN

oServer:Execute("UPDATE mitabla SET ext = '123'")
 

Puedes agregarle un WHERE con su condicion si no quieres que sea a toda la tabla
User avatar
cmsoft
 
Posts: 1291
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Llenar campo con MariaDB

Postby acuellar » Tue Feb 26, 2019 2:31 pm

Muchas gracias estimado Cesar

Funciona, pero no actualiza el Browse
Con con TDolphin se usa: oBrw:SetDolphin(oSQL)

Cómo es con MariaDB?
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Postby nageswaragunupudi » Tue Feb 26, 2019 4:04 pm

With FWH Mariadb
(same with browsing dolphin query also)

Code: Select all  Expand view  RUN
oCn:Execute("UPDATE mitabla SET ext = '123'")
oRs:Requery()
oBrw:Refresh()
Regards

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

Re: Llenar campo con MariaDB

Postby acuellar » Tue Feb 26, 2019 4:49 pm

Thanks Mr Rao

it worked perfect

This code does not work, I can not add records
Code: Select all  Expand view  RUN

     oSQL:Seek(cNom)
     If oSQL:Eof()
               ?"Append"  <-Do not enter
               oSQL:Append();oSQL:NOMBRE:=cNom;oSQL:EXT:=cExt;oSQL:TAMANO:=nTam;oSQL:TIPO:=cTipo;oSQL:POSTER:="";oSQL:UBICACION:=ZpDir
       Else
                oSQL:NOMBRE:=cNom;oSQL:EXT:=cExt;oSQL:TAMANO:=nTam;oSQL:TIPO:=cTipo;oSQL:UBICACION:=ZpDir
        Endif
 


How is it?

Regards
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Postby nageswaragunupudi » Tue Feb 26, 2019 5:23 pm

Code: Select all  Expand view  RUN
if oSql:Seek( cNom )
   oSql:Update( "EXT,TAMANO,TIPO,UBIACTION", { cExt, nTam, cTipo, ZpDir } )
else
   oSql:Append( "NOMBRE,EXT,TAMANO,TIPO,POSTER,UBIACTION", ;
                       { cNom, cExt, nTam, cTipo, "", ZpDir } )
endif
Regards

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

Re: Llenar campo con MariaDB

Postby acuellar » Wed Feb 27, 2019 1:37 pm

Thanks Mr. Rao


How to do this
Code: Select all  Expand view  RUN

  oSQL:Gotop()
  Do While !oSQL:Eof()
   If Empty(oSQL:DURACION) .And. Empty(oSQL:POSTER) )
      oSQL:Delete()
   Endif
   oSQL:Skip()
  Enddo


//I tried like this
   oCn:Execute("DELETE "+cTABLA+" WHERE Empty(DURACION) And Empty(POSTER)")   //but it does not work
 


Thank you very much for your time
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Postby carlos vargas » Wed Feb 27, 2019 5:12 pm

please try
oCn:Execute("DELETE FROM "+cTABLA+" WHERE LENGTH(DURACION)=0 And LENGTH(POSTER)=0")
or
oCn:Execute("DELETE FROM "+cTABLA+" WHERE DURACION='' And POSTER='' ")

please try first in heidisql or other frontend
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
carlos vargas
 
Posts: 1721
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Llenar campo con MariaDB

Postby acuellar » Wed Feb 27, 2019 8:52 pm

Gracias Estimado Carlos

No funciona
Realice varias pruebas con HeidiSQL, ni comparando con NULL borra
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Postby nageswaragunupudi » Thu Feb 28, 2019 7:52 am

Assuming DURATION and POSTER are VarChar fields, try using this where clause
Code: Select all  Expand view  RUN

DELETE FROM <table> WHERE ( DURATION IS NULL OR DURATION = '' ) AND ( POSTER IS NULL OR POSTER = '' )
 
Regards

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

Re: Llenar campo con MariaDB

Postby MGA » Thu Feb 28, 2019 1:02 pm

:wink:
DELETE FROM <table> WHERE COALESCE(DURATION,'') = '' AND COALESCE(POSTER,'') = ''
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Llenar campo con FWH MariaDB

Postby acuellar » Thu Feb 28, 2019 3:13 pm

Thanks Mr. Rao

Perfect
Code: Select all  Expand view  RUN

DELETE FROM <table> WHERE ( DURATION IS NULL OR DURATION = '' ) AND ( POSTER IS NULL OR POSTER = '' )
 


Obrigado senhor MGA
Perfeito
Code: Select all  Expand view  RUN

DELETE FROM <table> WHERE COALESCE(DURATION,'') = '' AND COALESCE(POSTER,'') = ''
 
Saludos,

Adhemar C.
User avatar
acuellar
 
Posts: 1644
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 58 guests