ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Struggling with SQL!
@ 2021-06-03 10:51 Gerard Verhaag
  2021-06-03 18:43 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Gerard Verhaag @ 2021-06-03 10:51 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 2365 bytes --]

Hi,

I'm trying to get MySQL data access working but can't solve the issues I'm encountering. Part of my code looks like:

\startluacode
productsheet = productsheet or {}
function productsheet.sqldatabase(database,user,password)
   productsheet:sql(database,user,password)
end
function productsheet:sql(db,us,pw)
print("SQLDATABASE: database: " .. db)
print("SQLDATABASE: username: " .. us)
print("SQLDATABASE: password: " .. pw)
local sql = require("util-sql")
local presets = {database = db,username = us,password = pw,host= "localhost",port= 3306}
local template = [[SELECT `nom`, `name_alias` FROM `llx_societe` WHERE `nom` = '%nom%' ;]]
presets.id = "mysql"
local data, keys = utilities.sql.execute {presets=presets,template=template,variables={nom = "Life"}}
...


This generates the following issues:

sql > start loading method 'library'
lua error > lua error on line 153 in file /home/gverhaag/Stock/ProductSheet/productsheet_KG594.tex:
/usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: module 'luasql.mysql' not found:
no field package.preload['luasql.mysql']
no file '/usr/local/share/lua/5.2/luasql/mysql.lua'
no file '/usr/local/share/lua/5.2/luasql/mysql/init.lua'
no file '/usr/local/lib/lua/5.2/luasql/mysql.lua'
no file '/usr/local/lib/lua/5.2/luasql/mysql/init.lua'
no file './luasql/mysql.lua'
no file '/usr/local/lib/lua/5.2/luasql/mysql.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './luasql/mysql.so'
no file '/usr/local/lib/lua/5.2/luasql.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './luasql.so'
stack traceback:
[C]: in function 'requiem'
/usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: in function </usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:165>
(...tail calls...)
...are/texmf/tex/context/base/mkiv/util-sql-imp-library.lua:74: in main chunk
[C]: in function 'requiem'
/usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:180: in function </usr/share/texmf/tex/context/base/mkiv/l-sandbox.lua:165>
(...tail calls...)
/usr/share/texmf/tex/context/base/mkiv/util-sql.lua:114: in function '__index'
/usr/share/texmf/tex/context/base/mkiv/util-sql.lua:288: in function 'execute'
[ctxlua]:21: in function 'sql'
[ctxlua]:5: in function 'sqldatabase'
[ctxlua]:1: in main chunk


Must be something basic, I guess! I use the TexLive 2017 version of ConTeXt.

Any idea what I'm doing wrong here?

[-- Attachment #1.2: Type: text/html, Size: 6340 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Struggling with SQL!
  2021-06-03 10:51 Struggling with SQL! Gerard Verhaag
@ 2021-06-03 18:43 ` Hans Hagen
  2021-06-04 19:09   ` G.C.H.M. Verhaag
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2021-06-03 18:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerard Verhaag

On 6/3/2021 12:51 PM, Gerard Verhaag wrote:
> Hi,
> 
> I'm trying to get MySQL data access working but can't solve the issues 
> I'm encountering. Part of my code looks like:
it's probably better to use

   \usemodule[sql]

you also need to have the sql library in the tex binary tree

(see manual)

(in luatex/mkiv it's best to use the ffi variant that interfaces to the 
mysql library; in luametatex/lmtx it's a - by default - build in 
optional which loads the lib on demand; in all cases most happens in lua)

so, if it doesn't work, you have to explain your setup

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Struggling with SQL!
  2021-06-03 18:43 ` Hans Hagen
@ 2021-06-04 19:09   ` G.C.H.M. Verhaag
  2021-06-05 11:45     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: G.C.H.M. Verhaag @ 2021-06-04 19:09 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 1879 bytes --]

Hans, thanks for your answer. I also tried \usemodule[sql] with the same 
result however!

The system I use is Ubuntu 18.01 and installed TeXStudio, that's all.

That also installs TeX/LaTeX/ConTeXt, but probably that's causing the 
issues!

Hopefully a complete reinstall of TeXLive will solve the issue.

Regards,
Gerard

On 03-06-2021 20:43, Hans Hagen wrote:
> On 6/3/2021 12:51 PM, Gerard Verhaag wrote:
>> Hi,
>>
>> I'm trying to get MySQL data access working but can't solve the 
>> issues I'm encountering. Part of my code looks like:
> it's probably better to use
>
>   \usemodule[sql]
>
> you also need to have the sql library in the tex binary tree
>
> (see manual)
>
> (in luatex/mkiv it's best to use the ffi variant that interfaces to 
> the mysql library; in luametatex/lmtx it's a - by default - build in 
> optional which loads the lib on demand; in all cases most happens in lua)
>
> so, if it doesn't work, you have to explain your setup
>
> Hans
>
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
-- 

Sender:G.C.H.M. Verhaag
St. Jorisstraat 29
5954 AN Beesel
NETHERLANDS

       Tel.: +31-(0)619502702, E-mail: verhaaggchm@ziggo.nl

Ik vertrouw erop dat de persoonlijke gegevens, te vinden in deze mail,
uitsluitend voor correspondentie met ondergetekende worden gebruikt en
beslist niet voor reclamedoeleinden of welke andere wijze dan ook. Het
opnemen van deze gegevens, in welk soort van opslagsysteem dan ook,
evenals het doorgeven ervan aan derden, zie ik als een schending van
mijn privacy.

	


[-- Attachment #1.2.1: Type: text/html, Size: 4709 bytes --]

[-- Attachment #1.2.2: pasfoto_17112017_cropped_113x78_72dpi.png --]
[-- Type: image/png, Size: 15518 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Struggling with SQL!
  2021-06-04 19:09   ` G.C.H.M. Verhaag
@ 2021-06-05 11:45     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2021-06-05 11:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users, G.C.H.M. Verhaag

On 6/4/2021 9:09 PM, G.C.H.M. Verhaag wrote:
> Hans, thanks for your answer. I also tried \usemodule[sql] with the same 
> result however!
> 
> The system I use is Ubuntu 18.01 and installed TeXStudio, that's all.
> 
> That also installs TeX/LaTeX/ConTeXt, but probably that's causing the 
> issues!
> 
> Hopefully a complete reinstall of TeXLive will solve the issue.
otherwise try a minimal install (mkiv or lmtx) from the garden


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-05 11:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 10:51 Struggling with SQL! Gerard Verhaag
2021-06-03 18:43 ` Hans Hagen
2021-06-04 19:09   ` G.C.H.M. Verhaag
2021-06-05 11:45     ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).