FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour error al eliminar con tdolphin y mysql
Posts: 84
Joined: Tue Jul 26, 2016 09:52 PM
error al eliminar con tdolphin y mysql
Posted: Fri Jan 12, 2018 06:07 PM

Estimados se me presenta el siguiente error..

Tengo una consulta, de una tabla, que deseo eliminar un resgistro... tengo otras tablas y uso la misma rutina y borra y procesa bien, pero esta me da problemas.. la tenia con JOIN, y se caia todo, se los saque y cuando proceso, me sale esto..

Time from start: 0 hours 0 mins 59 secs
Error occurred at: 12/01/2018, 15:00:49
Error description: Error BASE/1005 Class: 'ARRAY' has no property: BGOTOP
Args:
[ 1] = A { ... }
[ 2] = B {|| ... }

Stack Calls

Called from: => _BGOTOP( 0 )
Called from: D:\KPIWEB\PRG\setbrw.prg => SETDOLPHIN( 22 )
Called from: D:\KPIWEB\PRG\extintores.prg => ELIMINARECEPEXTINTOR( 4855 )
Called from: D:\KPIWEB\PRG\extintores.prg => (b)ELIMINA_RECEPEXTINTOR( 4840 )

y la funcion es

// nNro_Rec = numero de orden a eliminar
// cExt_Rec = tabla que contiene los datos
// oBrw2 = es el objeto en xBrowse que contiene la tabla
// y la abro asi..
// cExt_Rec1:=xServer:Query("SELECT * FROM ext_rec1 WHERE nro_rec >='"+Alltrim(Str(cFolio1))+"' and nro_rec<='"+Alltrim(Str(cFolio2))+"' ORDER BY nro_rec")

FUNCTION EliminaRecepExtintor(cAClave,oBrw2,cEmpresa,nNro_Rec,cExt_Rec1)
Local Mensaje, cSql

Mensaje := Space(40)

If Alltrim(cAclave)=Alltrim( cEmpresa [15])

cExt_Rec1:delete()
SetDolphin( oBrw2, cExt_Rec1,.f. )
oBrw2:SetFocus()
oBrw2:Refresh()

cSql:=&quot;DELETE FROM Ext_Otr1 WHERE nro_rec='&quot;+Alltrim(Str(nNro_Rec))+&quot;'ORDER BY nro_rec&quot;
xServer:Execute( cSql )

Else
TipoMensaje("Usuario no habilitado")
Endif
RETURN( NIL )

Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: error al eliminar con tdolphin y mysql
Posted: Sat Jan 13, 2018 04:21 PM

Buen dia, esta tabla Ext_Otr1 la tienes relacionada.? a mi me da error eliminando cuando esta relacionada y por eso uso DELETE LOW_PRIORITY o si no debes usar la misma sintaxis del SELECT pero con DELETE...y no olvides dejar un espacio en blanco entre cada una de las clausulas en la setencia SQL cuando usas las variables, revisa antes de la clausula ORDER BY, ejemplo: "DELETE FROM Ext_Otr1 WHERE nro_rec='"+Alltrim(Str(nNro_Rec))+"' ORDER BY nro_rec"...saludos, gracias... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 581
Joined: Tue Oct 11, 2005 11:28 AM
Re: error al eliminar con tdolphin y mysql
Posted: Sun Jan 14, 2018 02:49 AM

Hola,

No existe DELETE con ORDER BY...

Kleyber Derick



FWH / xHb / xDevStudio / SQLLIB
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: error al eliminar con tdolphin y mysql
Posted: Sun Jan 14, 2018 06:16 PM
Kleyber wrote:Hola,

No existe DELETE con ORDER BY...

Kleyber, refuto tu afirmacion...saludos... :-)


https://dev.mysql.com/doc/refman/5.7/en/delete.html

Single-Table Syntax

DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]

Order of Deletion

If the DELETE statement includes an ORDER BY clause, rows are deleted in the order specified by the clause. This is useful primarily in conjunction with LIMIT. For example, the following statement finds rows matching the WHERE clause, sorts them by timestamp_column, and deletes the first (oldest) one:

DELETE FROM somelog WHERE user = 'jcole'
ORDER BY timestamp_column LIMIT 1;

ORDER BY also helps to delete rows in an order required to avoid referential integrity violations
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM
Re: error al eliminar con tdolphin y mysql
Posted: Mon Jan 15, 2018 11:05 AM
Code (fw): Select all Collapse
cSql:="DELETE FROM Ext_Otr1 WHERE nro_rec='"+Alltrim(Str(nNro_Rec))+"' ORDER BY nro_rec"

Si tienes el programa tal cual lo pusiste en el foro, te falta un espacio en la sentencia cuando concatenas..

Continue the discussion