Skip to Content.
Sympa Menu

freetds - [freetds] Row problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Row problem
  • Date: Tue, 18 Mar 2008 12:16:19 +0100

I'm trying to add support for varchar(max) and similars (found on
mssql2005).
However these types are quite particular. See current way data are
packages in memory for rows and parameters.

ROWS
====
Cols
+----------+
0 | Data --------+
| cur_size | |
| ... | |
+----------+ |
1 | Data --------|-------+
| cur_size | | |
| ... | V V
+----------+ +-------+-----------+---------------+
| ... | | int a | blob b | ... |
+-------+-----------+---------------+
| textvalue ----> Real blob
| testptr |
| timestamp |
+-----------+
data_free is null
row_free delete the row

- difficult to store rows
(cur_size must be saved and restred, used only in dblib)
- save some space for fixed data
- save many allocations
- can be a waste of space for long varchar

PARAMS
======

Cols
+----------+ +-------+
0 | Data -------->| int a |
| cur_size | +-------+
| ... |
+----------+ +-----------+
1 | Data -------->| blob b |
| cur_size | +-----------+
| ... | | textvalue ----> Real blob
+----------+ | testptr |
| ... | | timestamp |
+-----------+

data_free delete a single column
row_free is null

- do not support rows so you have to save every pointers
- waste for fixed data
- more allocations



Problem for adding varchar(max) and similar

Blob have a proper structure not very useful for varchar(max)
Handling like varchar is not feasible (too waste, varchar can be 2gb...)

so, how should we threat these types??
Perhaps structure should be changed? Should we remove row concept (dblib
already save cur_size so it can save data, data_free too) ?? Handle like
blobs?? In this case is_blob_type macro is not sufficient or we should
add some new types (not server ones, XSYBVARCHAR have a limited maximun
or not depending on column_size). Threat long varchar like blobs (do not
allocate them on row) ? This would reduce waste in case of long varchar
(like varchar(8000)).
Package data in different way where row offsets are not constants and
keep long data not in a row??

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page