Re: How to convert array to string, and vice versa



In article <xvHcg.10455$S.4851@xxxxxxxxxxxxxxxxxxxx>,
Oli Filth <catch@xxxxxxxxxxxxxx> wrote:

Tim Streater said the following on 23/05/2006 17:49:
I have some items, numbered from 0 upwards. Some of them may have a
string attached. All these items need to be represented in a single
already existing database record. So, I thought of taking an array, as
it might be looking thus (the values are all strings):

Key Value
--- -----
0 firstone
2 somestring
5 anotherstr


and so on, and converting it to a single string:

"'0', 'firstone', '2', 'somestring', '5', 'anotherstr'"

then I have a string I can write to the database record.


Is it absolutely mandatory that you put these into a single record?
This is almost certainly a bad idea. Not only do you have to write
conversion functions to get data into and out of the database, but you
data is no longer atomic. Amongst other things, this makes it difficult
to search, index, delete or reference your data...

The one record in question is for an interface card, typically in a
router or an SDH box. Up to now the ports on the card have been
considered identical and are numbered incrementally, so I have just kept
a record for the card, with a field numports. Now we wish to keep
information about the port optics (short-reach, long-reach, etc). With
the advent of plug-in optics this may vary from port to port.

The most general/flexible/futureproof way to do this would evidently be
to have a set of port-records, pointing to the interface card. Then,
obviously, the optics information would just be a field in the port
record.

I have resisted doing it this way up to now, because:

1) this would be a major change to the way the data is held, and more
importantly, displayed on our web pages, and interacted with.

2) it would prolly slow down the functionality a lot as there would be
an extra layer of things to do per port.

3) It's seemed a bit heavy to do this for just one bit of information
per port

4) I haven't got time to do this much work on this item.

So, I am looking for a quick'n'dirty fix :-) which will cause minimal
disruption on the rest of the structure.

I agree with your prospective downsides.

-- tim
.



Relevant Pages

  • Re: Migrating from VB6 and Printer object
    ... You can use the GetPrinter API call to get all the information (such as Port name) - e.g. ... ByRef phPrinter As Int32, _ ... Public pServerName As String ... Dim dmOut As New DEVMODE ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Serial port error statistics - any comparable data?
    ... Alas - the port in question is the native legacy motherboard port. ... The "cluster" in all the cases observed is the loss of exactly one character, ... "The quick brown fox jumps over the lazy dog 0123456789" ... the string from a port unblocked with fcntl - and the throw away python ...
    (comp.lang.python)
  • Using IIS 7 to relaying off Yahoo smtp server
    ... server: smtp.mail.yahoo.com. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Using IIS 7 to relaying off Yahoo smtp server
    ... smtp outgoing mail server. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: Using IIS 7 to relaying off Yahoo smtp server
    ... server: smtp.mail.yahoo.com. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)