comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Lundin" <b.f.lundin@gmail.com>
Subject: Re: converting pointer to value
Date: Fri, 5 Mar 2021 08:06:27 +0100	[thread overview]
Message-ID: <s1sl9k$gdf$1@dont-email.me> (raw)
In-Reply-To: <s1r33v$qsn$1@gioia.aioe.org>

Den 2021-03-04 kl. 17:50, skrev Dmitry A. Kazakov:
> 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.
> 
> 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.

Yeah, I doubt it i supported - but I find the feature I use working.
A colleague did fix the 64bit changes,

I should have mentioned that this is Linux on 64bit that I try.
It will run on windows 64 bit (which is the same code) and I might
port it to Windows 32-bit - but that I have not decided yet.




> 
>> 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:

hmm, I usually rebind after an execute. I now realize I don't have to.
thanks.


> 
> 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.

hmm I did not think of that. But - if the clob is big enough - that will 
not help. But yes - my use case has likely clobs less than a few Mb.

Anyway, some docs* I found describes Clob handling as

use bind to bind nothing to the col - but tag it
execute (will then return NEED_MORE_DATA)
ParamData will return NEED_MORE_DATA and indicate what col that needs 
the data (which is the problem i want to solve first)
loop
   putDAta
   exit when put enough data
loop
final call to ParamData will now indicate SUCCESS.


And I got that part to work to some extent. (if I putData in chunks of 
10 bytes and I said size= 100. But not if size = 104. Likely an error on 
my part)
And yes that small size is just me testing. chunks will be in larger 
sizes when I get it to work.

docs*
<https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlputdata-function?view=sql-server-ver15>

<https://jeffpar.github.io/kbarchive/kb/128/Q128720/>



/Björn








> 


-- 
Björn

  reply	other threads:[~2021-03-05  7:06 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
2021-03-05  7:06   ` Björn Lundin [this message]
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