Cobol Foro

Cobol Foro (https://www.cobolforo.es/index.php)
-   Cocina PowerCOBOL (https://www.cobolforo.es/forumdisplay.php?f=24)
-   -   [PowerCOBOL] Cobol + Sqlite (https://www.cobolforo.es/showthread.php?t=786)

Joseg 20 de diciembre de 2017 11:30

Cobol + Sqlite
 
Para quem pretende aceder ao Sqlite sem ter que fazer nenhuma instalação.
Acesso muito rápido.
Tenho um sistema em produção que movimenta Gbytes sem qualquer problema.

Um exemplo:
Código COBOL:
  1.  01 comando.
  2.     03          pic x(15) value "sqlite3 ex1.db ".
  3.     03 mystring pic x(200).
  4.  
  5. - Nova base de dados:
  6.      INVOKE pow-self "Execute" USING 'sqlite3.exe ex1.db  .quit' POW-SWHIDE
  7.  
  8. - Nova tabela
  9.      INVOKE pow-self "ExecuteSync" USING 'sqlite3 ex1.db ";create table tb1 (tb1key INTEGER
  10.                 PRIMARY KEY,data TEXT,num double,timeEnter DATE);";' POW-SWHIDE
  11.  
  12.  
  13. - Atualizar
  14.      string '";insert into tb1 (data,num) ' delimited by size  "values ('Linha1,9);" delimited by
  15.                   size '";' delimited by size into  mystring
  16.      INVOKE pow-self "Execute" USING comando POW-SWHIDE
  17.  
  18.      string '";insert into tb1 (data,num) ' delimited by size  "values ('Linha2,19);" delimited by
  19.                   size '";' delimited by size into  mystring
  20.      INVOKE pow-self "Execute" USING comando POW-SWHIDE
  21.  
  22.      string '";insert into tb1 (data,num) ' delimited by size  "values ('Linha3,212);" delimited by
  23.                   size '";' delimited by size into  mystring
  24.      INVOKE pow-self "Execute" USING comando POW-SWHIDE
  25.  
  26. - query
  27.      INVOKE pow-self "ExecuteSync" USING 'sqlite3 ex1.db ";select * from tb1";; >teste.txt' POW-     SWHIDE
  28.  
  29. - ver resultado:  
  30.     Processar teste.txt
  31.  ou
  32.     move "CommandLine" OF pow-self to "Caption" OF CmStatic1   ----> não testei isto, não sei se funciona


La franja horaria es GMT +2. Ahora son las 14:45.

Powered by: vBulletin, Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.