Discussion:
[freetds] How to fetch data from uniqueidentifier field?
Velichko Yuriy
2014-01-22 10:13:57 UTC
Permalink
Hello!

Point me please how to proper fetch data from uniqueidentifier field.
The function

dbcoltype()

returns 36 for this datatype. How I can convert the data of such type to
the string representation?

Here

http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html

I found the similar question but can't to find the answer.
--
Best Regards!
Velichko Yuriy
2014-01-22 11:25:02 UTC
Permalink
I found the SQL solution for this issue: CAST or CONVERT functions.
But question still valid - is there a way to convert data by the freetds
lib API?
Post by Velichko Yuriy
Hello!
Point me please how to proper fetch data from uniqueidentifier field.
The function
dbcoltype()
returns 36 for this datatype. How I can convert the data of such type to
the string representation?
Here
http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html
I found the similar question but can't to find the answer.
--
Best Regards!
--
Best Regards!
Frediano Ziglio
2014-01-22 14:24:10 UTC
Permalink
Did you try dbconvert ??

Frediano
Post by Velichko Yuriy
I found the SQL solution for this issue: CAST or CONVERT functions.
But question still valid - is there a way to convert data by the freetds
lib API?
Post by Velichko Yuriy
Hello!
Point me please how to proper fetch data from uniqueidentifier field.
The function
dbcoltype()
returns 36 for this datatype. How I can convert the data of such type to
the string representation?
Here
http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html
I found the similar question but can't to find the answer.
--
Best Regards!
--
Best Regards!
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
Velichko Yuriy
2014-01-22 14:59:23 UTC
Permalink
Please accept my apologies for the silly question. I was confused the lack
of a macro for this data type in the documentation and I thought that it
is not supported.

dbconvert - performs converting properly.
Post by Frediano Ziglio
Did you try dbconvert ??
Frediano
Post by Velichko Yuriy
I found the SQL solution for this issue: CAST or CONVERT functions.
But question still valid - is there a way to convert data by the freetds
lib API?
On 22 January 2014 12:13, Velichko Yuriy <velichko.yuriy at gmail.com>
Post by Velichko Yuriy
Hello!
Point me please how to proper fetch data from uniqueidentifier field.
The function
dbcoltype()
returns 36 for this datatype. How I can convert the data of such type to
the string representation?
Here
http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html
I found the similar question but can't to find the answer.
--
Best Regards!
--
Best Regards!
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--
Best Regards!
Velichko Yuriy
2014-01-22 17:28:44 UTC
Permalink
Unfortunately, using if function dbconvert leads to crash of my
application. At this time I can't figure out the reason.

I use similar code to transform datatypes fetched from the server. For
UniqueIdentifier it looks like:

int dataLength = dbdatlen( mpConn, i + 1 );
int dataLength = dbdatlen( conn, colIndex );

BYTE* msData = dbdata( conn, colIndex );

if( msData == NULL )
{
// BREAK
}
else
{
switch( fldDataType )
{

case UniqueIdentifier :

{

if( !dbwillconvert( 36, SYBCHAR ) )

break;



BYTE* charData = new BYTE[ dataLength ];

dbconvert( conn, 36, msData, dataLength, SYBCHAR,
charData, ( DBINT ) -1 );


AddValue( MyString( ( char *) charData ) );



delete [] charData;

}

}

}

........

If I comment this pice of code the app works fine. In other case it crashes
on processing large amount of data.
Post by Velichko Yuriy
Please accept my apologies for the silly question. I was confused the lack
of a macro for this data type in the documentation and I thought that it
is not supported.
dbconvert - performs converting properly.
Post by Frediano Ziglio
Did you try dbconvert ??
Frediano
Post by Velichko Yuriy
I found the SQL solution for this issue: CAST or CONVERT functions.
But question still valid - is there a way to convert data by the freetds
lib API?
On 22 January 2014 12:13, Velichko Yuriy <velichko.yuriy at gmail.com>
Post by Velichko Yuriy
Hello!
Point me please how to proper fetch data from uniqueidentifier field.
The function
dbcoltype()
returns 36 for this datatype. How I can convert the data of such type
to
Post by Velichko Yuriy
Post by Velichko Yuriy
the string representation?
Here
http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html
I found the similar question but can't to find the answer.
--
Best Regards!
--
Best Regards!
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--
Best Regards!
--
Best Regards!
Velichko Yuriy
2014-01-22 17:42:05 UTC
Permalink
1 Sorry for the unformatted code, the mail was sent accidentally.
2 The crash was fixed by reserving more space for buffer.
Post by Velichko Yuriy
Unfortunately, using if function dbconvert leads to crash of my
application. At this time I can't figure out the reason.
I use similar code to transform datatypes fetched from the server. For
int dataLength = dbdatlen( mpConn, i + 1 );
int dataLength = dbdatlen( conn, colIndex );
BYTE* msData = dbdata( conn, colIndex );
if( msData == NULL )
{
// BREAK
}
else
{
switch( fldDataType )
{
{
if( !dbwillconvert( 36, SYBCHAR ) )
break;
BYTE* charData = new BYTE[ dataLength ];
dbconvert( conn, 36, msData, dataLength, SYBCHAR,
charData, ( DBINT ) -1 );
AddValue( MyString( ( char *) charData ) );
delete [] charData;
}
}
}
........
If I comment this pice of code the app works fine. In other case it
crashes on processing large amount of data.
Post by Velichko Yuriy
Please accept my apologies for the silly question. I was confused the
lack of a macro for this data type in the documentation and I thought that
it is not supported.
dbconvert - performs converting properly.
Post by Frediano Ziglio
Did you try dbconvert ??
Frediano
Post by Velichko Yuriy
I found the SQL solution for this issue: CAST or CONVERT functions.
But question still valid - is there a way to convert data by the
freetds
Post by Velichko Yuriy
lib API?
On 22 January 2014 12:13, Velichko Yuriy <velichko.yuriy at gmail.com>
Post by Velichko Yuriy
Hello!
Point me please how to proper fetch data from uniqueidentifier field.
The function
dbcoltype()
returns 36 for this datatype. How I can convert the data of such type
to
Post by Velichko Yuriy
Post by Velichko Yuriy
the string representation?
Here
http://lists.ibiblio.org/pipermail/freetds/2009q3/024815.html
I found the similar question but can't to find the answer.
--
Best Regards!
--
Best Regards!
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--
Best Regards!
--
Best Regards!
--
Best Regards!
Loading...