Row problem

"ZIGLIO, Frediano, VF-IT" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.