Jump to content
Fivewin Brasil

ACESSO NATIVO A MARIA DB


marcioe

Recommended Posts

Pessoal eu uso a SLQLLIB, e diga-se de passagem é bem boa, porem está descontinuada.

Pois bem 

Estou tentando passa para o acesso "nativo do Fivewin" ao mariadb, mas sem exito

dá o Seguinte erro

Application
===========
   Path and name: C:\PROJETOS\NATIVO\NATIVO.EXE (32 bits)
   Size: 3,913,216 bytes
   Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20181011)
   FiveWin  version: FWH 18.11
   C compiler version: Borland/Embarcadero C++ 7.3 (32-bit)
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 12/18/18, 18:07:00
   Error description: Error BASE/3012  Argument error: STRTOHEX
   Args:
     [   1] = U   
     [   2] = U   

Stack Calls
===========
   Called from:  => STRTOHEX( 0 )
   Called from: .\source\internal\FWMARIA.PRG => FWMARIACONNECTION:NEW( 5259 )
   Called from:  => HB_EXECFROMARRAY( 0 )
   Called from: .\source\internal\FWMARIA.PRG => MARIA_CONNECT( 141 )
   Called from: C:\PROJETOS\NATIVO\PRG_OBJ\SISTEMA.PRG => CONNECTTO( 65 )
   Called from: C:\PROJETOS\NATIVO\PRG_OBJ\SISTEMA.PRG => MAIN( 23 )

System
======

#Include "FiveWin.ch"

#define CRLF Chr( 13 ) + Chr( 10 )
#define HKEY_LOCAL_MACHINE      2147483650        // 0x80000002

//ANNOUNCE RDDSYS
REQUEST OrdKeyNo, OrdKeyCount, OrdKeyGoto
REQUEST DBFCDX, DBFFPT

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850

//--------------------------------------------------------------------------//
Function Main()
	LOCAL oQry, cCmdSql, cText, wRowId:=0
	PRIVATE cServer   := "localhost"
	PRIVATE cUser     := "root"
	PRIVATE cPassword := 123
	PRIVATE nPort     := 3306
	PRIVATE cDBName   := "imobiliaria"
	PRIVATE nFlags    := 0
	PRIVATE oServer   := NIL
   IF ( oServer := ConnectTo() ) == NIL
      msgAlert("Erro de conexão")
      return nil
   else
   	MsgInfo('Acessou')
	ENDIF
   oQry = oServer:Query( "SELECT * FROM nombres" )
          oQry:GoBottom()
           cCmdSql:= "INSERT INTO nombres ( "
           cCmdSql += "nombre"    + ","
           cCmdSql += "apellido1" + ","
           cCmdSql += "apellido2" + ","
           cCmdSql += "direccion" + ","
           cCmdSql += "edad"      + ","
           cCmdSql += "poblacion" + ","
           cCmdSql += "provincia )"
           cCmdSql += "VALUES("
           cCmdSql += "'"+cNombre+"'"     +","
           cCmdSql += "'"+cApellido1+"'"  +","
           cCmdSql += "'"+cApellido2+"'"  +","
           cCmdSql += "'"+cDireccion+"'"  +","
           cCmdSql += ""+str(cEdad)+""    +","
           cCmdSql += "'"+cPoblacion+"'"  +","
           cCmdSql += "'"+cProvincia+"' )"
           oServer:Execute( cCmdSql )
           IF oServer:nError = 0
              MSGRUN(OemToAnsi("Registros inclusos com Sucesso..."),OemToAnsi("ATENۂO..."))
           ELSE
              MSGRUN(OemToAnsi("Nao foi possivel Incluir os Registros..."),OemToAnsi("ATENۂO..."))
              oServer:ShowError()
           ENDIF
   oServer:End()
   msginfo("Fim da Conexao...")

Return Nil


//----------------------------------------------------------
FUNCTION ConnectTo()
LOCAL oErr
LOCAL cText := ""

   FWCONNECT oServer HOST cServer USER cUser PASSWORD cPassword DATABASE cDBName
	   if oServer == nil
      MsgAlert( "Failed to connect" )
      return nil
   ELSE
      cText += "Connection OK" + CRLF
      cText += "Host: " + cServer +CRLF
      cText += "Database: " +cDBName + CRLF
      cText += "" + CRLF
      cText += ""
      msginfo( cText ,"Dados da conexão ")
   ENDIF

RETURN(oServer)
//--------------------------------------------------------------------//
// FIM DO PROGRAMA




 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...