Page 1 of 1
error al borrar registro con xbrowse, tdophin, mysql
Posted: Thu Jul 12, 2018 9:15 pm
by kpidata
Estimados tengo el siguiente problema, cuando hago una consulta tal como:
cTab_Modelo:=XServer:Query("SELECT cod_modelo, nom_modelo, cod_marca FROM tab_modelo ORDER BY cod_modelo")
le doy por eliminar un registro en particular, con esta instrucción, todo funciona
STATIC FUNCTION DelModelo(oBrw,cEmpresa,cAclave,cTab_Modelo)
cTab_Modelo:delete()
SetDolphin( oBrw, cTab_Modelo,.f. )
cTab_Modelo:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
RETURN( NIL )
Pero si hago esto mismo, con una base relacionada.
cTab_Modelo:=xServer:Query("SELECT a.cod_modelo, a.nom_modelo, a.cod_marca, b.cod_marca, b.nom_marca FROM tab_modelo AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca ORDER BY a.cod_modelo")
me tira error.. y es solo esto... el LEFT JOIN... me genera esto ???
Time from start: 0 hours 0 mins 43 secs
Error occurred at: 12/07/2018, 17:06:54
Error description: Error MYSQL/1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca WHERE cod_modelo = '2' at line 1
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Fri Jul 13, 2018 3:07 am
by joseluisysturiz
Saludos, tenia el mismo probela y la recomendacon es que uses el mismo comando SQL de la consulta para hacer el DELETE o como lo hago ahora, uses DELETE LOW_PIORITY, asi te borra el registro sin problemas, saludos...
https://dba.stackexchange.com/questions ... visibility
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Sat Jul 14, 2018 1:32 pm
by nageswaragunupudi
If you want to delete a record ( dolphin or any other ) when browsing, simply call:
This is simple to use.
Very safe.
If you use FWH builtin methods you do not commit bugs.
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Sun Jul 15, 2018 1:36 am
by joseluisysturiz
nageswaragunupudi wrote:If you want to delete a record ( dolphin or any other ) when browsing, simply call:
This is simple to use.
Very safe.
If you use FWH builtin methods you do not commit bugs.
Mr RAO, cuando el registro que se va a borrar esta en una tabla relacionada(mysql), da error y no lo borra con oBrw:delete()...gracias...
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Mon Jul 16, 2018 3:15 pm
by kpidata
Estimado, como se indica, el borrar solo opera a una tabla unica sin relacion de ningun tipo, pero si la relaciono, se cae la aplicación
En este caso, se me cae
cTab_Modelo:=xServer:Query("SELECT a.cod_modelo, a.nom_modelo, a.cod_marca, b.cod_marca, b.nom_marca FROM tab_modelo AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca ORDER BY a.cod_modelo")
Time from start: 0 hours 0 mins 36 secs
Error occurred at: 16/07/2018, 11:08:14
Error description: Error MYSQL/1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca WHERE cod_modelo = '9' at line 1
Asi como se muestra, funciona bien
cTab_Modelo:=XServer:Query("SELECT cod_modelo, nom_modelo, cod_marca FROM tab_modelo ORDER BY cod_modelo")
esta es la funcion
STATIC FUNCTION DelModelo(oBrw,cEmpresa,cAclave,cTab_Modelo, cod_modelo)
Local cSql
If Alltrim(cAclave)=Alltrim( cEmpresa [15])
cTab_Modelo:delete()
SetDolphin( oBrw, cTab_Modelo,.f. )
cTab_Modelo:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
Else
TipoMensaje("Usuario no habilitado")
Endif
RETURN( NIL )
y se invoca asi..
Redefine BtnBmp oBtn2[3] Id 103 Resource "BTO_BORRA" Of oDlg 2007;
ACTION (Del_Modelo(oBrw,cTab_Modelo,cEmpresa,cTab_Modelo:cod_modelo),cTab_Modelo:Refresh(),oBrw:Refresh(),oBrw:Gotop()) Tooltip "Permite Borrar y/o Eliminar Registro.."
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Mon Jul 16, 2018 7:54 pm
by cmsoft
Preuba Asi
Code: Select all
STATIC FUNCTION DelModelo(oBrw,cEmpresa,cAclave,cTab_Modelo, cod_modelo)
Local cSql
If Alltrim(cAclave)=Alltrim( cEmpresa [15])
if cTab_Modelo:IsSingleTable()
cTab_Modelo:delete()
ELSE
XServer:Execute("DELETE FROM tab_modelo WHERE cod_modelo = " ClipValue2Sql(cTab_Modelo:cod_modelo))
ENDIF
cTab_Modelo:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
Else
TipoMensaje("Usuario no habilitado")
Endif
RETURN( NIL )
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Tue Jul 17, 2018 1:46 am
by joseluisysturiz
kpidata wrote:Estimado, como se indica, el borrar solo opera a una tabla unica sin relacion de ningun tipo, pero si la relaciono, se cae la aplicación
En este caso, se me cae
cTab_Modelo:=xServer:Query("SELECT a.cod_modelo, a.nom_modelo, a.cod_marca, b.cod_marca, b.nom_marca FROM tab_modelo AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca ORDER BY a.cod_modelo")
Time from start: 0 hours 0 mins 36 secs
Error occurred at: 16/07/2018, 11:08:14
Error description: Error MYSQL/1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right
syntax to use near 'AS a LEFT JOIN tab_marca AS b ON a.cod_marca = b.cod_marca WHERE cod_modelo = '9' at line 1
Asi como se muestra, funciona bien
cTab_Modelo:=XServer:Query("SELECT cod_modelo, nom_modelo, cod_marca FROM tab_modelo ORDER BY cod_modelo")
esta es la funcion
STATIC FUNCTION DelModelo(oBrw,cEmpresa,cAclave,cTab_Modelo, cod_modelo)
Local cSql
If Alltrim(cAclave)=Alltrim( cEmpresa [15])
cTab_Modelo:delete()
SetDolphin( oBrw, cTab_Modelo,.f. )
cTab_Modelo:Refresh()
oBrw:SetFocus()
oBrw:Refresh()
Else
TipoMensaje("Usuario no habilitado")
Endif
RETURN( NIL )
y se invoca asi..
Redefine BtnBmp oBtn2[3] Id 103 Resource "BTO_BORRA" Of oDlg 2007;
ACTION (Del_Modelo(oBrw,cTab_Modelo,cEmpresa,cTab_Modelo:cod_modelo),cTab_Modelo:Refresh(),oBrw:Refresh(),oBrw:Gotop()) Tooltip "Permite Borrar y/o Eliminar Registro.."
REPITO MI RESPUESTA INICIAL...usa DELETE LOW_PIORITY, asi te borra el registro sin problemaso cambia DELETE por SELECT en la consulta por, saludos...
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Tue Jul 17, 2018 3:10 am
by nageswaragunupudi
oBrw:Delete() in turn calls oQry:Delete() or oRs:Delete().
All the three libraries DOLPHIN, TMYSQL and ADO do NOT support Append, Modify, Delete operations on a query with join.
There is only one library, i.e., FWH MariaDB library that supports all operations Append, Modify and Delete of data in the main table of a query with joins also very smoothly. These operations work just like they work with a single table query. We can modify the joining field and we see a refreshed view of the row immediately. All this is done without requery. (Requery is time-consuming and puts undue strain on server and network traffic and good programming practices avoid requery unless essential).
FWH created the library not only to overcome the limitations of the existing librarries, but also provide for the very high end neeeds of Corporate programmers heavily relying on server-side scripting.
This sample program compares FWH Mariadb, Dolphin and ADO. Anyone having FWH 16.08 or later can compare all three libraries.
Code: Select all
#include "fivewin.ch"
function Main()
local nLib, oCn, oRs, cSql
if ( nLib := Alert( "Select Library", { "FWH-MARIALIB", "ADO", "DOLPHIN" } ) ) == 0
return nil
endif
oCn := FW_DemoDB( { nil, "ADO", "DLP" }[ nLib ] )
cSql := "SELECT c.id, c.first as name, c.city, c.state as code, s.name as statename FROM customer c LEFT JOIN states s ON c.state = s.code ORDER by c.id"
if nLib == 1
oRs := oCn:RowSet( cSql )
elseif nLib == 2
oRs := FW_OpenRecordSet( oCn, cSql )
else // nLib == 3
oRs := oCn:Query( cSql )
endif
XBROWSER oRs FASTEDIT
if nLib == 3
oRs:End()
oCn:End()
else
oRs:Close()
oCn:Close()
endif
return nil
EXTERNAL TDOLPHINSRV
Re: error al borrar registro con xbrowse, tdophin, mysql
Posted: Tue Jul 17, 2018 6:51 am
by joseluisysturiz
GOOGLE TRASLATOR
Mr RAO, thank you very much for your explanation, I think it's time to move my systems to the FWH Mariadb library to jump the limitations of the good LIB Dolphin and ADO that gave the initiative to their improvements with FWH Mariadb and thus increase security of data and speed of processes, thanks...
Mr RAO, muchas gracias por su explicacion, creo que es hora de ir pasando mis sistemas a la libreria FWH Mariadb para asi saltar las limitaciones de las buenas LIB Dolphin and ADO que dieron la iniciativa a sus mejoras con FWH Mariadb y asi aumentar la seguridad de la data y rapidez de los procesos, gracias...