<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19298">
<STYLE>@font-face {
        font-family: Calibri;
}
@page WordSection1 {size: 612.0pt 792.0pt; margin: 72.0pt 72.0pt 72.0pt 72.0pt; }
P.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
LI.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
DIV.MsoNormal {
        MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        FONT-FAMILY: "Calibri","sans-serif"; COLOR: windowtext; mso-style-type: personal-compose
}
.MsoChpDefault {
        FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US; mso-style-type: export-only
}
DIV.WordSection1 {
        page: WordSection1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-GB link=blue vLink=purple>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=317220111-20092012></SPAN><FONT color=#0000ff size=2
face=Arial>><SPAN class=118124710-20092012><FONT color=#0000ff size=2
face=Arial>I think your initial command would have set the 'type' (eprint type)
to 'text' for all your eprints. Eeek!</FONT></SPAN></FONT></DIV>
<DIV><SPAN class=118124710-20092012></SPAN><SPAN
class=317220111-20092012></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2>A<SPAN class=317220111-20092012>ctually, it should complain about an
unknown column 'field'. If there was a column named 'field' in the eprints
table, and it contained the value 'num_pieces' then the 'type' column for it
would have been set to 'text'.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=317220111-20092012></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=317220111-20092012>You did the right thing in checking - it's a dangerous
(but powerful) thing having this level of database access
:o)</SPAN></FONT></FONT></FONT></DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> eprints-tech-bounces@ecs.soton.ac.uk
[mailto:eprints-tech-bounces@ecs.soton.ac.uk] <B>On Behalf Of </B>John
Salter<BR><B>Sent:</B> 20 September 2012 11:55<BR><B>To:</B>
'eprints-tech@ecs.soton.ac.uk'<BR><B>Subject:</B> [EP-tech] Re: MySQL query to
update a column value<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>NOOO!
STOP STOP STOP!</FONT></SPAN></DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>An
'update eprint' command will edit the data in the table, not the structure of
the table itself.</FONT></SPAN></DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>You
need an 'ALTER TABLE' command, something like (this is untested, and
off-the-top-of-my-head-and-therefore-possibly-not-right. Anyone else care to
comment?):</FONT></SPAN></DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>ALTER
TABLE eprint MODIFY num_pieces TEXT;</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>See
this (or an appropriate version for your MySQL version)</FONT></SPAN></DIV>
<DIV><A href="http://dev.mysql.com/doc/refman/5.1/en/alter-table.html"><FONT
face=Arial><FONT
size=2>http://dev.mysql.com/doc/refman/5.1/en/alter-table.html</FONT></FONT></A></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2 face=Arial>I
think your initial command would have set the 'type' (eprint type) to 'text' for
all your eprints. Eeek!</FONT></SPAN></DIV>
<DIV><SPAN class=118124710-20092012></SPAN> </DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2
face=Arial>Cheers,</FONT></SPAN></DIV>
<DIV><SPAN class=118124710-20092012><FONT color=#0000ff size=2
face=Arial>John</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> eprints-tech-bounces@ecs.soton.ac.uk
[mailto:eprints-tech-bounces@ecs.soton.ac.uk] <B>On Behalf Of </B>Claire
Eskriett<BR><B>Sent:</B> 20 September 2012 11:37<BR><B>To:</B>
eprints-tech@ecs.soton.ac.uk<BR><B>Subject:</B> [EP-tech] MySQL query to update
a column value<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=WordSection1>
<P class=MsoNormal>Hi all<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I’ve edited eprints.pl to change the property of an eprint
field from an integer to text but running update_database_structure has not
updated the eprint table. I’ve been advised to update manually using MySQL and
have come up with the following:<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Use <database name><o:p></o:p></P>
<P class=MsoNormal>Update eprint<o:p></o:p></P>
<P class=MsoNormal>Set type = text<o:p></o:p></P>
<P class=MsoNormal>Where field = num_pieces<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I think this is ok – I’ve specified the table (eprint) and
the field that I want to update (num_pieces) and the column that I want updating
is ‘type’. The current row in the table is as follows:<o:p></o:p></P>
<P
class=MsoNormal><B>Field
|
Type | Null | Key | Default |
Extra<o:p></o:p></B></P>
<P
class=MsoNormal>num_pieces
| int(11) | YES | MUL |
NULL | |<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Can anyone take pity on me and reassure me that this is ok? I
ask as a MySQL novice. <o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Many thanks for any advice!<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Claire<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">Claire Eskriett, Systems
Librarian<o:p></o:p></SPAN></B></P>
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">(Days of work are Mon,
Tues, Thurs & Fri)<o:p></o:p></SPAN></B></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">Information
Services<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">Cockcroft
Building<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">University of
Brighton<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">Lewes
Road<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">Brighton BN2
4GJ<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">T:
01273 642766<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="FONT-SIZE: 10pt; mso-fareast-language: EN-GB">E:
C.Eskriett@brighton.ac.uk<o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P></DIV><BR
clear=both>___________________________________________________________<BR>This
email has been scanned by MessageLabs' Email Security<BR>System on behalf of the
University of Brighton.<BR>For more information see
http://www.brighton.ac.uk/is/spam/<BR>___________________________________________________________<BR></BODY></HTML>