marcosgambeta / sqlrddpp Goto Github PK
View Code? Open in Web Editor NEWSQLRDD for Harbour++ and Harbour
License: GNU General Public License v2.0
SQLRDD for Harbour++ and Harbour
License: GNU General Public License v2.0
Ao tentar compilar com a versão atual do harbour tenho os seguintes erros:
hbmk2: Harbour: Compilando módulos...
hbmk2: Harbour compiler command (built-in):
(e:\harbour\bin\harbour.exe) -n1 source\sqlconnection.prg source\sqlfirebird.prg source\sqlfirebird3.prg source\sqlfirebird4.prg source\sqlfirebird5.prg source\sqlgen1.prg source\sqlmaria.prg source\sqlmy.prg source\sqlodbc.prg source\sqloracle.prg source\sqloracle2.prg source\sqlpgs.prg source\sqlrdd0.prg source\sqlrdd2.prg source\utils.prg source\utilslang.prg sqlrddpp.hbx -n -w -es2 -gc3 -D__HBEXTREQ__ -DHBMK_HAS_HBCT=1 -DHBMK_HAS_HBTIP=1 -DHBMK_HAS_HBFSHIP=1 -DHBMK_HAS_HBXPP=1 -DHBMK_HAS_HBWIN=1 -DHBMK_HAS_XHB=1 -olib\win\mingw64.hbmk\win\mingw64\ -ie:\harbour\include -iinclude -iinclude\firebird -iinclude\mysql -iinclude\oci -iinclude\pgsql -isource -ie:\harbour\contrib\xhb -ie:\harbour\contrib\hbct -ie:\harbour\contrib\hbtip -ie:\harbour\contrib\hbfship -ie:\harbour\contrib\hbxpp -ie:\harbour\contrib\hbwin -u+e:\harbour\contrib\hbwin\hbwin.ch
Harbour 3.2.0dev (r2310291327)
Copyright (c) 1999-2021, https://harbour.github.io/
Compiling 'source\sqlconnection.prg'...
source\sqlconnection.prg(326) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(327) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(328) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(794) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR5'
source\sqlconnection.prg(796) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR4'
source\sqlconnection.prg(798) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR3'
source\sqlconnection.prg(1220) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(1230) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR3'
source\sqlconnection.prg(1230) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR4'
source\sqlconnection.prg(1230) Warning W0001 Ambiguous reference 'SYSTEMID_FIREBR5'
source\sqlconnection.prg(1251) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(1252) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(1303) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(1304) Error E0055 CASE requires either numeric or string constant
source\sqlconnection.prg(1305) Error E0055 CASE requires either numeric or string constant
9 errors
No code generated.
hbmk2[sqlrddpp]: Error: Running Harbour compiler (built-in). 1
(e:\harbour\bin\harbour.exe) -n1 source\sqlconnection.prg source\sqlfirebird.prg source\sqlfirebird3.prg source\sqlfirebird4.prg source\sqlfirebird5.prg source\sqlgen1.prg source\sqlmaria.prg source\sqlmy.prg source\sqlodbc.prg source\sqloracle.prg source\sqloracle2.prg source\sqlpgs.prg source\sqlrdd0.prg source\sqlrdd2.prg source\utils.prg source\utilslang.prg sqlrddpp.hbx -n -w -es2 -gc3 -D__HBEXTREQ__ -DHBMK_HAS_HBCT=1 -DHBMK_HAS_HBTIP=1 -DHBMK_HAS_HBFSHIP=1 -DHBMK_HAS_HBXPP=1 -DHBMK_HAS_HBWIN=1 -DHBMK_HAS_XHB=1 -olib\win\mingw64.hbmk\win\mingw64\ -ie:\harbour\include -iinclude -iinclude\firebird -iinclude\mysql -iinclude\oci -iinclude\pgsql -isource -ie:\harbour\contrib\xhb -ie:\harbour\contrib\hbct -ie:\harbour\contrib\hbtip -ie:\harbour\contrib\hbfship -ie:\harbour\contrib\hbxpp -ie:\harbour\contrib\hbwin -u+e:\harbour\contrib\hbwin\hbwin.ch
Como resolver?
Desde já agradeço a atenção recebida.
Hi Marcos,
I have encountered the following error when compiling HarbourPP + SQLRDDPP under Ubuntu 22.
Thanks,
Mario
../../../../../../source/sqlsrodbc.c: In function ‘void HB_FUN_SR_GETCONNECTOPTION()’:
../../../../../../source/sqlsrodbc.c:1005:16: error: invalid conversion from ‘char’ to ‘SQLPOINTER’ {aka ‘void*’} [-fpermis]
1005 | buffer[0] = '\0';
| ^~~~
| |
| char
hbmk2[sqlrddpp]: Error: Running C/C++ compiler. 1
g++ -c -O3 -W -Wall -pipe -I'/home/mhsabado/win_d/harbourpp/include' -I../../../../../../include -I../../../../../../sourcc
Hi, when I try to connect via OCI, the function
OracleConnectionString_s = "OCI=xxxx.xxx.xxx.xxxx;UID=uuuuuu;PWD=XXXXXXX;TNS=TNS_NAME"
SR_ADDCONNECTION(CONNECT_ORACLE,OracleConnectionString_s )
returns an v$session error. I confirmed in a normal sql environment that we don't have access to the v$session system table, but are able to run normal queries and updates.
Hi Marcos,
I have done local testing of uploading 166k records and noticed a difference performance difference. Using INET takes 1.86 minutes while XNET takes 1.47 minutes. That's ~24 seconds performance gain. May not be relevant for regular data processing but would save minutes for bulk uploads (i.e., data migration, dbf export, etc.).
Thanks,
Mario
Connecting to FIREBIRD3=xnet://;dtb=c:\firebird\firebird_5_0\data\TEST.FDB;uid=SYSDBA;pwd=masterkey;client=fbclient.dll;charset=ISO8859_1;
RDD in use : SQLRDD
09/21/23 12:09:40.926
Uploading... stokmast (166976 records)
Elapsed: 1.47 min
Hi Marcos,
I have tested MariaDB 5.5 with ODBC 3.1 DSN and DSN-Less connection using SQLEX and got the ff error. The same test works fine using SQLRDD. I also observed that Logical Data Type is translated to TinyInt.
Thanks,
Mario
Error SQLRDD/0 SQL execution error at dbGoTop, return code: -1, state: 42000, description: [ma-3.1.19][5.5.68-MariaDB]You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"sr_recno", A."sr_deleted" FROM test
A
ORDER BY A."sr_recno" ASC LIMIT 26' at line 1.
Called from DBCREATE(0)
Called from MAIN(56)
┌──────────────────────────────────────────────┐
│ Error SQLEX/1010 Argument error: test
│
│ │
│ Quit │
└──────────────────────────────────────────────┘
Hi Marcos,
I have tested the tests/firebird2.prg file and used an ODBC connection instead. It works fine with SQLRDD but when I use SQLEX, I have the following error below:
nConnection := sr_AddConnection(CONNECT_ODBC,"driver=Firebird/InterBase(r) driver;server=localhost;port=3050;uid=SYSDBA;pwd=masterkey;database=c:\firebird\firebird_4_0\data\test.fdb;client=fbclient.dll;charset=ISO8859_1;")
C:\sqlrddpp\tests>firebird2
Error SQLRDD/0 SQL execution error at dbGoTop, return code: -1, state: HY000, description: [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Unexpected end of command - line 1, column 10.
Called from DBGOTOP(0)
Called from MAIN(61)
Error SQLEX/1010 Argument error: "TEST"
Called from DBGOTOP(0)
Called from MAIN(61)
C:\sqlrddpp\tests>
Thanks,
Mario
HI Marcos,
I'm trying to compile sqlrddpp with ODBC only (without other native SQL connection clients) but I got the following error from sqlerror.log file.
Thanks,
Mario
09/23/23 09:32:23: SQLDriverConnect Error: No ODBC connection established 08004 - -902 - [ODBC Firebird Driver]Unable to complete network request to host "xnet://Global\FIREBIRD".
Marcos,
Com essas ultimas alterações do SQLRDD que eu não atualizava desde Janeiro/2024 passou a dar o erro abaixo, que não tinha anteriormente.
Error BASE/1068 Erro nos parƒmetros: acesso de array
Called from source\sqlrdd2.prg->SR_WORKAREA:LOADREGISTEREDTAGS(688)
Called from source\sqlrdd2.prg->SR_WORKAREA:SQLOPENAREA(6884)
Called from source\syg_rdd.prg->USE_ARQ(1331)
Called from source\errorsys.prg->SYG_DEFERROR(137)
Called from source\errorsys.prg->(b)ERRORSYS(19)
Called from source\anexar_img.prg->DBSELECTAREA(0)
Called from source\sagi.prg->VEREFICA_LOGIN(2202)
Called from source\sagi.prg->(b)MAIN(1662)
Called from source\htimer.prg->HWG_TIMERPROC(105)
Called from source\hwindow.prg->HWG_ACTIVATEMDIWINDOW(0)
Called from source\hwindow.prg->HMAINWINDOW:ACTIVATE(396)
Called from source\sagi.prg->MAIN(1722)
Data e Hora........: 29/02/2024 - 01:35:26
Versão compilador..: HwGUI 2.17 Harbour 3.2.0dev (r2402161723)
Compilador C/C++...: Borland/Embarcadero C++ 7.4 (32-bit)
Banco de Dados.....: POSTGRESQL NATIVE - PostgreSQL 13.12, compiled by Visual C++ build 1914, 64-bit
Até tentei voltar esse commit abaixo para testar, mesmo assim da erro.
fa273a2
Abaixo minha FUNCTION USE_ARQ
*===============================================================================
* FUNCTION Use_Arq(cArquivo,cAlias,iShared,iLeitura,iTemp,iabre_auto)
*-------------------------------------------------------------------------------
*
*-------------------------------------------------------------------------------
* cArquivo : Nome do Arquivo
* cAlias : Nome do Apelido(ALIAS)
* iShared : .f.=Exclusivo - .t.=Compartilhado
* iLeitura : .t.=sómente Leitura - .f.=Leitura e Gravação
* iTemp : .t.=usa uma tabela temporaria - .f.=abre uma tabela normal
* iabre_auto: .t. ou .f. =força abertura - nil=não abre na abertura do modulo
*===============================================================================
FUNCTION USE_ARQ(cArquivo,cAlias,iShared,iLeitura,iTemp,iabre_auto)
Local oERROR
Local cDriver := "DBFCDX"
Local lResp :=.t.
Local nTENTATIVA_RDD:=0
IF UPPER(ALLTRIM(cArquivo))='TEMPDROPCO' .OR. cArquivo='tempdropco' // TABELA TEMPORARIA DO SQLRDD
// showmsg('tentou abrir a tabela temporaria do sqlrdd')
Return .T.
ENDIF
IF cAlias=Nil
IF iShared= .T. // SE FOR COMPARTILHADO
IF iTemp = .F.
IF iabre_auto=Nil
Return(.T.)
ENDIF
ENDIF
ENDIF
cAlias=cArquivo
ENDIF
if iTemp = .F.
cDriver:="SQLRDD"
endif
if iTemp = .T.
cDriver:="DBFCDX"
endif
IF cDriver="SQLRDD" .OR. cDriver="SQLLIB"
IF _plTABELAS_EXC()
AADD( _paTABELAS_EXC() ,ALLTRIM(UPPER(cArquivo))) // ADICIONA NO VETOR PUBLICO OS NOMES DAS TABELAS QUE PRECISA EXCLUIR OS INDICES
ENDIF
ENDIF
do while .t.
IF SELECT(cAlias)=0
*TRY
DBSELECTAREA(0) // SELECIONA A PROXIMA AREA LIVRE
DbUseArea(.t.,cDriver,cArquivo,cAlias,iShared,iLeitura,,)
/*catch oERROR
nTENTATIVA_RDD:=nTENTATIVA_RDD+1
IF nTENTATIVA_RDD>=3
lResp := HWG_MsgRetryCancel( "Erro ao Tentar Abrir a Tabela: " + cArquivo + ", Favor revisar a conexão com o Servidor ! " + oERROR:Description )
IF lResp
REABRE_CONEXAO()
loop
ELSE
Focaliza_App(_PCNOMEDIALOGMAIN())
Return(.F.)
ENDIF
ELSE
loop
ENDIF
END*/
IF NetErr()
lResp := HWG_MsgRetryCancel( "Sistema em Uso em Modo Exclusivo por Outra Estação no Momento !" )
IF lResp
loop
ELSE
Return(.F.)
ENDIF
else
SELECT(cAlias)
Return(.T.)
endif
ELSE
&cAlias->(DbCloseArea()) // FECHA PARA ABRIR DE NOVO
LOOP
ENDIF
enddo
Return(.F.)
Hi Marcos,
I have tested the tests/firebird1.prg and tests/firebird2.prg. I have changed the corresponding values for SERVER, UID, PWD and DTB but
this line encountered error:
nConnection := sr_AddConnection(CONNECT_FIREBIRD3, "FIREBIRD=" + SERVER + ";UID=" + UID + ";PWD=" + PWD + ";DTB=" + DTB)
Changing above line this works fine:
nConnection := sr_AddConnection(CONNECT_FIREBIRD3,"FIREBIRD=127.0.0.1:c:\firebird\firebird_4_0\data\TEST.FDB;uid=SYSDBA;pwd=masterkey;client=fbclient.dll;charset=ISO8859_1;")
Thanks,
Mario
Hi Marcos,
Testing PostgreSQL (v9.3) using "PostgreSQL UNICODE" driver with your latest commit, the error reduced to the following:
Error SQLEX/1020 Data type error: data type origin: 128 - data type target 1024
Called from MAIN(71)
...........................
IF reccount() < 100
FOR n := 1 TO 100
APPEND BLANK
REPLACE ID WITH n
REPLACE FIRST WITH "FIRST" + hb_ntos(n)
REPLACE LAST WITH "LAST" + hb_ntos(n)
REPLACE AGE WITH n + 18
REPLACE DATE WITH date() - n
REPLACE MARRIED WITH iif(n / 2 == int(n / 2), .T., .F.) //Line #71
REPLACE VALUE WITH n * 1000 / 100
NEXT n
ENDIF
...................
Thanks,
Mario
Hi Marcos,
I'm compiling with msvc 2022 and i get this errors.
hbmk2 mysql1.prg -llibmysql.lib
odbccp32.lib(dllload.obj) : error LNK2019: símbolo externo __vsnwprintf_s sin resolver al que se hace referencia en la función _StringVPrintfWorkerW@20
I solved with add "-llegacy_stdio_definitions.lib" .
Hi Marcos,
I tried tests\mysql1.prg, and work fine, but on "CLOSE DATABASE" i have this error:
Error DBCMD/1015 Argument error: DBUSEAREA
Called from DBUSEAREA(0)
Called from SR_WRITEDBLOG(753)
Called from SR_MYSQL:EXEC(409)
Called from SR_EXISTTABLE(1267)
Called from MAIN(38)
Error DBCMD/1015 Argument error: DBUSEAREA
Called from DBUSEAREA(0)
Called from SR_WRITEDBLOG(753)
Called from SR_CONNECTION:ROLLBACK(895)
Called from SR_MYSQL:ROLLBACK(297)
Called from SR_ENDCONNECTION(1345)
Called from SR_END(1459)
And i can't solve error.
if comented "sr_StartLog(nConnection)" works fine.
Thank you.
Can you help me?
Pere
Hi Marco,
Are you try to compile / link any sample ?
I tried to demo01.prg and i have this error "fatal error LNK1181: no se puede abrir el archivo de entrada 'hbrtl.lib'"
cmdline: hbmk2 demo01.prg sqlrddpp.hbc -i..\include
Any tips ?
Thank you.
Hello,
I have a problem with a database with MariaDb.
When I create a table with numeric fields for example 4 digits with collation "latin_bin", when I do dbstruct() it tells me that the size is 5 digits.
On the other hand if I have the collation "utf8_general_ci" it returns the correct value.
How can I fix this issue?
Thank you
Petter
Caro Marcos,
Na versão do xHarbour era possível executar o seguinte código:
conexao = 'pgs=192.168.10.10;uid=sysadmin;pwd=v8xy14;dtb=hrb_quito;prt=5440'
x = Sr_Addconnection( CONNECT_POSTGRES, conexao)
xQuery:="select codigo, descricao from itens limit 200"
use &xQuery via "SQLRDD" alias titens
set index to "codigo" // criava um indice virtual para a query aberta
seek "000825"
hoje esse código dá erro de:
Bound error: array access
É possível executar algo parecido com a atual versão para harbour?
Mestre Marcos.
Tive que fazer uma alteração aqui no SQLRDD depois de muito teste.
Por algum motivo na versão xHarbour ( lib compilada que tenho aqui antiga ) dava certo e no Harbour dava errado.
Sempre que usava a function SR_cDBValue que por sua vez chama a function SR_SubQuoted, com campos vazio( ex: SR_cDBValue('')) ele gerava um E'' e, isso quebrava na hora de gerar os retortos para mostrar em tela ou gerar macro conforme exemplo abaixo:
cADD:=''
aCOL:=DBSTRUCT() // aqui pega uma estrutura de uma tabela minha
FOR mY:=1 TO LEN(aCOL)
IF alltrim(aCOL[mY,1])='NUMBOL'
cADD+='0,'
ELSEIF alltrim(aCOL[mY,1])='ORDEM_NRO_IMPR'
cADD+='0,'
ELSEIF alltrim(aCOL[mY,1])='MEDIA_VOLUME'
cADD+='0,'
ELSEIF alltrim(aCOL[mY,1])='QTD'
cADD+='0,'
ELSEIF alltrim(aCOL[mY,1])='PRODUTO'
cADD+="'',"
ELSE
IF VALTYPE(RETORNA_TIPO_CAMPO('ORDEM',alltrim(aCOL[mY,1])))='D'
cADD+='CTOD(SPACE(8)),'
ELSEIF VALTYPE(RETORNA_TIPO_CAMPO('ORDEM',alltrim(aCOL[mY,1])))='L'
cADD+='.F.,'
ELSE
cADD+=CS(RETORNA_TIPO_CAMPO('ORDEM',alltrim(aCOL[mY,1])))+","
ENDIF
ENDIF
NEXT
cADD+="0,'','',0"
aVET:={{ &cADD }}
Colocando para ver na tela o que cada versão gerou:
cADD:="0,E'',E'',E'',E'',E'',E'',E'',E'',E'',CTOD(SPACE(8)),E'',E'',E'',E'',0,'','',0," //HARBOUR
cADD:="0,'','','','','','','','','',CTOD(SPACE(8)),'','','','',0,'','',0" //XHARBOUR(versão do SQLRDD antes de abrirem como opensource)
Então acabei mudando em UTILS.PRG para comentar as linhas 595 e 596, conforme abaixo:
Eu testei com: POSTGRESQL 9.5, 10, 13 e 16 e deram varios SQL certo depois dessa alteração.
Hi Marcos,
I have tested the new sample odbcfirebird2.prg and I got the following error. The odbcfirebird1.prg works fine.
Thanks,
Mario
C:\sqlrddpp\tests>odbcfirebird2
Error SQLRDD/0 SQL execution error at dbGoTop, return code: -1, state: HY000, description: [ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -104
Unexpected end of command - line 1, column 10.
Called from DBGOTOP(0)
Called from MAIN(76)
Error SQLEX/1010 Argument error: "TEST"
Called from DBGOTOP(0)
Called from MAIN(76)
HI Marcos,
I have tested your new commits for FirebirdSQL 4 and 5 using the tests\firebird1.prg and got the following error in the log. The same problem also occurs when using xnet.
10/08/23 06:14:49: Undefined SQL datatype: 510
10/08/23 06:14:49: Unsupported data type at column DATE : 510
Steatment handle :
Connection handle :
RetCode : 0
SR_FIREBIRD5:RUNTIMEERR Linha : 960
SR_FIREBIRD5:INIFIELDS Linha : 220
SR_WORKAREA:INIFIELDS Linha : 3411
SR_WORKAREA:SQLOPENAREA Linha : 6816
DBUSEAREA Linha : 0
MAIN Linha : 46
Thanks,
Mario
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.