Page 1 of 1
Llenar campo con MariaDB
Posted: Mon Feb 25, 2019 9:35 pm
by acuellar
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
oSQL:Gotop()
Do While !oSQL:Eof()
oSQL:EXT:='123';oSQL:Save() //oSQL:Update()
oSQL:Skip()
Enddo
Gracias por la ayuda
Re: Llenar campo con MariaDB
Posted: Mon Feb 25, 2019 11:49 pm
by cmsoft
Hola Adhemar:
Con un execute en lugar de llenar registro por registro
Code: Select all
oServer:Execute("UPDATE mitabla SET ext = '123'")
Puedes agregarle un WHERE con su condicion si no quieres que sea a toda la tabla
Re: Llenar campo con MariaDB
Posted: Tue Feb 26, 2019 2:31 pm
by acuellar
Muchas gracias estimado Cesar
Funciona, pero no actualiza el Browse
Con con TDolphin se usa: oBrw:SetDolphin(oSQL)
Cómo es con MariaDB?
Re: Llenar campo con MariaDB
Posted: Tue Feb 26, 2019 4:04 pm
by nageswaragunupudi
With FWH Mariadb
(same with browsing dolphin query also)
Code: Select all
oCn:Execute("UPDATE mitabla SET ext = '123'")
oRs:Requery()
oBrw:Refresh()
Re: Llenar campo con MariaDB
Posted: Tue Feb 26, 2019 4:49 pm
by acuellar
Thanks Mr Rao
it worked perfect
This code does not work, I can not add records
Code: Select all
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
Re: Llenar campo con MariaDB
Posted: Tue Feb 26, 2019 5:23 pm
by nageswaragunupudi
Code: Select all
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
Re: Llenar campo con MariaDB
Posted: Wed Feb 27, 2019 1:37 pm
by acuellar
Thanks Mr. Rao
How to do this
Code: Select all
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
Re: Llenar campo con MariaDB
Posted: Wed Feb 27, 2019 5:12 pm
by carlos vargas
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
Re: Llenar campo con MariaDB
Posted: Wed Feb 27, 2019 8:52 pm
by acuellar
Gracias Estimado Carlos
No funciona
Realice varias pruebas con HeidiSQL, ni comparando con NULL borra
Re: Llenar campo con MariaDB
Posted: Thu Feb 28, 2019 7:52 am
by nageswaragunupudi
Assuming DURATION and POSTER are VarChar fields, try using this where clause
Code: Select all
DELETE FROM <table> WHERE ( DURATION IS NULL OR DURATION = '' ) AND ( POSTER IS NULL OR POSTER = '' )
Re: Llenar campo con MariaDB
Posted: Thu Feb 28, 2019 1:02 pm
by MGA
DELETE FROM <table> WHERE COALESCE(DURATION,'') = '' AND COALESCE(POSTER,'') = ''
Re: Llenar campo con FWH MariaDB
Posted: Thu Feb 28, 2019 3:13 pm
by acuellar
Thanks Mr. Rao
Perfect
Code: Select all
DELETE FROM <table> WHERE ( DURATION IS NULL OR DURATION = '' ) AND ( POSTER IS NULL OR POSTER = '' )
Obrigado senhor MGA
Perfeito
Code: Select all
DELETE FROM <table> WHERE COALESCE(DURATION,'') = '' AND COALESCE(POSTER,'') = ''