tags:

views:

51

answers:

2

I created far too big fields. I thought it would be cool to store PHP snippets to the db with the snippet, its source and its comment. You can see the problem, the showing of long fields:

+--------+-------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
|      1 | http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/specials/SpecialRandompage.php | I love how clean and proper OOP Wiki Media's code is. Definitely bookmarking it to show PHP newbies what good PHP code looks like (and to remind myself). | 
+--------+-------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+

It is ironic that SO solved one of my problems to read the content even before submitting the question! In contrast, the content is very messy in my terminal. I am unsure whether I should read the content in MySQL or outside. Taking periodic snapshots of the content may be cool by trasferring the content to other format such as pdf. So:

How do you manage long fields in MySQL?

Example of the mess when I am in MySQL Monitor

Example of the mess when copy-pasted to my terminal

+1  A: 

You could always create a little app (web or not, either way) to interface with your database. So you can format the text in a coherent way.

colithium
+1, or use one already existing, like phpMyAdmin.
Jørn Schou-Rode
+1  A: 

I'm not sure I understand the question completely.

If you mean, how do you make the formatting of displaying them nicer in CLI mysql client, then end the query with \G instead of ;. This will make the mysql client display each column on a separate row and would generally get rid of the mess. Of course, each row would then take a lot more space vertically.

If you mean, what are the limitations of fields storing a lot of data, then you have varchar, text, mediumtext, and longtext, among others.

If you mean, how do I navigate around and present this data better, I would recommend using Navicat for MySQL - they have a Linux version too. Just make sure you toggle the "Memo" button, which shows the widget with text in it. You'll understand if you install it.

Artem Russakovskii
I added photos. In short, how can I read those things? Or how can I even control them if I cannot see them in a structured way? The structure is visually broken, but it is there as you can see the copy-pasted text in SO.
Masi
I gave my answers. Try \G and if it doesn't work for you, I suggest trying Navicat.
Artem Russakovskii
For example, `select * from bla\G` instead of `select * from bla;`
Artem Russakovskii
+1 for illustrating how to use the \G option.
Masi