Llenar campo con MariaDB

Post Reply
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Llenar campo con MariaDB

Post 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
Saludos,

Adhemar C.
User avatar
cmsoft
Posts: 653
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Llenar campo con MariaDB

Post 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
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Post 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?
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Llenar campo con MariaDB

Post 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()
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Post 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
Saludos,

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Llenar campo con MariaDB

Post 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
Regards

G. N. Rao.
Hyderabad, India
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Post 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
Saludos,

Adhemar C.
User avatar
carlos vargas
Posts: 1421
Joined: Tue Oct 11, 2005 5:01 pm
Location: Nicaragua

Re: Llenar campo con MariaDB

Post 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
Salu2
Carlos Vargas
Desde Managua, Nicaragua (CA)
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con MariaDB

Post by acuellar »

Gracias Estimado Carlos

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

Adhemar C.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Llenar campo con MariaDB

Post 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 = '' )
 
Regards

G. N. Rao.
Hyderabad, India
MGA
Posts: 1219
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Re: Llenar campo con MariaDB

Post by MGA »

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

FWH17.04
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
User avatar
acuellar
Posts: 1312
Joined: Tue Oct 28, 2008 6:26 pm
Location: Santa Cruz-Bolivia

Re: Llenar campo con FWH MariaDB

Post 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,'') = ''
 
Saludos,

Adhemar C.
Post Reply