comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: converting pointer to value
Date: Thu, 4 Mar 2021 17:50:10 +0100	[thread overview]
Message-ID: <s1r33v$qsn$1@gioia.aioe.org> (raw)
In-Reply-To: s1r05i$d1$1@dont-email.me

On 2021-03-04 16:59, Björn Lundin wrote:

> I am trying to implement clob handling towards a database
> using the ODBC binding at <http://gnade.sourceforge.net/>

I do not think GNADE is supported and correct with the changes MS made 
to ODBC after the support was dropped.

> The ODBC API itself is somewhat awkward for this, but I have some Ada 
> issues as well.

There are actually two ODBC interfaces depending on the machine 
architecture, 32- and 64-bit. E.g. SQLSETPOSIROW is 16-bit or 64-bit, 
SQLLEN is 32- or 64-bit. That was the change MS did to ODBC for a decade 
ago, I believe.

> In one call I do the binding of data to a bind variable.
> 
>    insert into table A vales (?,?)
> 
> where the '?' are my bind variables in the sql.
> 
> Now, when data is small I call bindcol via
> 
>    Gnu.Db.Sqlcli.Sqlbindparameter
> 
> and put the wanted value into the binding.
> 
> But with CLOBs, there are too much data, so instead of setting
> the actual data, one is to indicate which column to put the
> data into - at a later time.

I do not understand this. Binding binds a variable to a prepared 
statement. You change the variable before each execution of the statement:

    prepare
    bind x to column 1
    bind y to column 2
    bind z to column 3

    x := 1;
    y := 20;
    z := 100;
    execute

    x := 11;
    y := -20;
    z := 10440;
    execute

    ...

Binding can be thought as by-reference parameter passing.

In case of blobs, if the size vary, you have to rebind it with another 
size before another statement execution. Unfortunately column size is a 
parameter of SQLBindParameter rather than the parameter data. If the 
size is same you only change the buffer contents. The buffer itself can 
be allocated once for its maximal size.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-03-04 16:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 15:59 converting pointer to value Björn Lundin
2021-03-04 16:50 ` Dmitry A. Kazakov [this message]
2021-03-05  7:06   ` Björn Lundin
2021-03-05  7:44     ` Dmitry A. Kazakov
2021-03-05  9:10       ` Björn Lundin
2021-03-04 16:55 ` Shark8
2021-03-04 17:35   ` Dmitry A. Kazakov
2021-03-04 19:38     ` Shark8
2021-03-04 21:27       ` Dmitry A. Kazakov
2021-03-05  8:58         ` Björn Lundin
2021-03-05  8:54     ` Björn Lundin
2021-03-05 11:02     ` Björn Lundin
2021-03-05 11:57       ` Björn Lundin
2021-03-05 14:00         ` Dmitry A. Kazakov
2021-03-09 12:07     ` [SOLVED] " Björn Lundin
2021-03-04 20:09   ` Simon Wright
2021-03-04 21:00     ` Shark8
2021-03-05  8:59       ` Björn Lundin
2021-03-05  7:10   ` Björn Lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox