Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » MSSQL binary data
Re: MSSQL binary data [message #19228 is a reply to message #19224] Fri, 21 November 2008 21:23 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
luzr wrote on Fri, 21 November 2008 09:24

Well, I needed to store image files into MSSQL and found we have no real support there yet...

I guess this should be addressed soon, anyway, for now, here is very simple function to workaround the insert/update (fetch seems to work):

SqlVal MsSqlBinary(const String& data)
{
	return SqlVal("convert(varbinary(max), '0x" + HexString(data) + "', 1)", SqlS::FN);
}


Mirek


Well, this simpler variant works too:

SqlVal MsSqlBinary(const String& data)
{
	return SqlVal("0x" + HexString(data), SqlS::HIGH);
}


Interestingly, it seems like similar method should work for Oracle and MySql as well:

http://www.herongyang.com/jdbc/Oracle-BLOB-SQL-INSERT.html

Something to add to SqlExp. So far, with Oracle, I was always using SqlRaw, but that means no SqlExp...

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: It is necessary BLOB field in MySQL
Next Topic: Possible SqlOption Problem [Solved]
Goto Forum:
  


Current Time: Fri May 10 02:37:27 CEST 2024

Total time taken to generate the page: 0.02106 seconds