473,419 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

How to store integer-array in SQL-Database in a BLOB ( Binary large object )

I want store an integer-array of 1000 Values in a blob in a SQL-database.

I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter
Nov 20 '05 #1
10 5194
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.

I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter

Nov 20 '05 #2
CJ,
If its always an Integer array. I would consider using System.Buffer to
block copy the integer array to & from an array of Bytes.

Of course the BinaryFormatter is more flexible.

Hope this helps
Jay

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.
I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter


Nov 20 '05 #3
Hey Jay,

Didn't know about that one. I was just going with the fastest/least
confusing way I could think of doing it with. =)

I have no idea why they want to do it, but I'm *assuming* (beware!) its
because he wants to maintain persistance in some way..

then again, I could be wrong.

-CJ

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ue****************@tk2msftngp13.phx.gbl...
CJ,
If its always an Integer array. I would consider using System.Buffer to
block copy the integer array to & from an array of Bytes.

Of course the BinaryFormatter is more flexible.

Hope this helps
Jay

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.
I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter



Nov 20 '05 #4
CJ,
I'm not sure what Peter's intent is either, I'm sure (hope at least) they
thought of the ramifications of storing arrays of integers in database
fields... I would have probably normalized the data into a child table...

Jay
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Hey Jay,

Didn't know about that one. I was just going with the fastest/least
confusing way I could think of doing it with. =)

I have no idea why they want to do it, but I'm *assuming* (beware!) its
because he wants to maintain persistance in some way..

then again, I could be wrong.

-CJ

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ue****************@tk2msftngp13.phx.gbl...
CJ,
If its always an Integer array. I would consider using System.Buffer to
block copy the integer array to & from an array of Bytes.

Of course the BinaryFormatter is more flexible.

Hope this helps
Jay

"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
> I want store an integer-array of 1000 Values in a blob in a

SQL-database.
>
> I will do this every 10 Seconds.
>
> How can I do this ????
>
> What datatypes a have to use ???
>
>
> Thanks
> for any help
> Peter
>
>



Nov 20 '05 #5
Hi Jay,

I was so sure that you would give the answer on

Dim aByte() as Byte
aByte = myIntegerArray.EncodedByJay

That I did not, because it is something I always have to search for and have
the idea that you know it direct.

The rest would be peanuts (Can work fine in my opinion).

(When you have no direct answer than tell it, it is not that I am to lazy
for it)
Cor
Nov 20 '05 #6
As I understood, you would prefere a Image-type ,

I dont know what is a "image" type

I am using SQL-AnyWhere From SYBASE 9.01

There is no image-type available for a column

Peter
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.
I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter


Nov 20 '05 #7
Peter,
An "image" type is a blob. For what ever SQl-AnyWhere's "blob" type is, you
can use the technique identified by CJ or I.

Hope this helps
Jay

"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
As I understood, you would prefere a Image-type ,

I dont know what is a "image" type

I am using SQL-AnyWhere From SYBASE 9.01

There is no image-type available for a column

Peter
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.
I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter



Nov 20 '05 #8
Further note...

Image type is a 16 byte pointer to a 2 gig max data segment in the database.
The varBinary field only allows a max of 8000 bytes I believe.

which sucks except for passwords.

=)

"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
As I understood, you would prefere a Image-type ,

I dont know what is a "image" type

I am using SQL-AnyWhere From SYBASE 9.01

There is no image-type available for a column

Peter
"CJ Taylor" <[cege] at [tavayn] dit commmmm> wrote in message
news:uJ**************@TK2MSFTNGP12.phx.gbl...
The best way is to use an image type in your database (gives you 2gb of
datastorage).

After that.. use a BinaryFormatter to serialize the array to binary
saveable format...

Insert into blob...

why you wnat to use a blob confuses me, but to each his own...
"Peter Stojkovic" <Pe*************@gmx.net> wrote in message
news:e0**************@TK2MSFTNGP09.phx.gbl...
I want store an integer-array of 1000 Values in a blob in a SQL-database.
I will do this every 10 Seconds.

How can I do this ????

What datatypes a have to use ???
Thanks
for any help
Peter



Nov 20 '05 #9
Cor,
Why would I give a "bogus" answer? :-) Or is myIntegerArray a class that has
a EncodedByJay method on it?

The OP wants to put an integer array into a database, the two "better"
methods of doing this is binary serialization or System.Buffer.BlockCopy.
The third "better" method would be XML serialization. IMHO any other method
would be "more" work, hence not as "better", however these other methods may
be more what the OP needs, for example, the OP could use a loop & a string
builder to convert the array into a comma separated string, then store the
string in the database. To get the array out, he could use String.Split &
Integer.Parse in a loop...

I don't really see where Encoding would apply in this question per se. As
encoding usually entails changing from one format to another, such as
Unicode to ASCII. I don't really see that the OP wants to change the format
of the integers such as from Unicode to ASCII... (unless you meant integer
array to String & back, then I'm following you).

If you had an idea of how the OP could "encode" the integer array to be
stored, by all means give it.

Hope this helps
Jay

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:e1**************@TK2MSFTNGP12.phx.gbl...
Hi Jay,

I was so sure that you would give the answer on

Dim aByte() as Byte
aByte = myIntegerArray.EncodedByJay

That I did not, because it is something I always have to search for and have the idea that you know it direct.

The rest would be peanuts (Can work fine in my opinion).

(When you have no direct answer than tell it, it is not that I am to lazy
for it)
Cor

Nov 20 '05 #10
Hi Jay,
Why would I give a "bogus" answer? :-) Or is myIntegerArray a class that has a EncodedByJay method on it?


I was a fool, I do not know why however in this thread I was thinking that
an integer was a byte, I hope that you understand that I know that it is
not.

Than because of your challenge I tried doing it. However I give up, the
result would have all in it I hate, unreadable trash made because it was a
challenge.

I could of course have serialized the integer array and than made from that
a blob, however that was something that was not my intention. I would have
made a bytearray of couples of 4 bytes.

:-)

Cor
Nov 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jose luis fernandez diaz | last post by:
Hi, My OS is: cronos:jdiaz:tmp>uname -a HP-UX cronos B.11.11 U 9000/800 820960681 unlimited-user license I compile in 64-bits mode the program below:
1
by: Paul W | last post by:
Hi - I'm doing simple XOR encryption on a password before storing it in a cookie. I use the same 2-way encryption/decryption routine at each end (before writing/after reading). Something is getting...
4
by: Jon | last post by:
i have a dataset with a few datatable inside. most of my table are have values as in integer or double. but everything i read my table out e.g. "row.Item("ItemName").ToString I always need to...
6
by: Martin Heuckeroth | last post by:
Hi, We are looking for a way to determine the x and y points of the cursor in a richtext box. We made an VB.NET application with a couple of listboxes and one of them is a richtextlistbox....
7
by: thisismyidentity | last post by:
Hi all, I am trying to predict the behaviour of floating point load and store operations on integer locations. I ve written a small piece of code having some inline assembly code which I am...
8
by: Candace | last post by:
I am using the following code to pick off each digit of a number, from right to left. The number I am working with is 84357. So for the first iteration it should return the number 7 and for the...
33
by: Prasad | last post by:
Hi, Can anyone please tell me how to store a 13 digit number in C language ? Also what is the format specifier to be used to access this variable ? Thanks in advance, Prasad P
7
by: laura | last post by:
Hi, I have a variable of type double. I need to know if there is an integer number store there. How can I test that ? I also have a default precision for doing this operation. Many thanks,...
39
by: rembremading | last post by:
Hi all! The following piece of code has (for me) completely unexpected behaviour. (I compile it with gcc-Version 4.0.3) Something goes wrong with the integer to float conversion. Maybe somebody...
2
by: guest124 | last post by:
Hi, I am having problem in converting an integer to character in the following program. It compiles but at run time there is no value in c. Could anyone help me with the problem. It is very...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.