473,410 Members | 1,977 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,410 software developers and data experts.

I have some questions...

Dear my friends...

My boss requested that my application is equipped with
emoicon (smiley) in the sales report. That's why I
need to know, is it possible to save a small image
into the postgres? with which data type should I
define the column (field)?

I have a currently table, salesreport. Its fields are
: noapp (appointment number, int4), salesid (int4),
custid (customer ID, int4), report (char(150)),
timestamp (timestamp).
I want to add a new column into an old table.
Something in MySQL like this:
"
alter table salesreport add column emoicon after
report
"

How can I do so on postgres?

Thank you very much in advance.

__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #1
3 1328
Prabu Subroto wrote:
My boss requested that my application is equipped with
emoicon (smiley) in the sales report. That's why I
need to know, is it possible to save a small image
into the postgres? with which data type should I
define the column (field)?
What do you mean by "equipped with emoicon (smiley) in the sales
report"? If you are producing some formatted output from your data
stored in database (HTML, PDF, whatever), I suggest you add the emoticon
on application level. You can store some representation of the emoticon
within the text (like ":-)" or ":-(") and then substitute this text on
application level with the image. If you realy want to store image data
in database (which I am not sure is a very good idea), you can use
binary data type, see
<http://www.postgresql.org/docs/7.4/static/datatype-binary.html>.
Something in MySQL like this:
"
alter table salesreport add column emoicon after
report
"


Read the manual on ALTER TABLE command
<http://www.postgresql.org/docs/7.4/static/sql-altertable.html>. You can
do this easily.

--
Michal Taborsky
http://www.taborsky.cz
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #2
Noo...noo.... I have to put the emoicon (image) into
database and the applications may use them. But your
advise is enough. Your advise solved my problem.

I still have problem with a new column into the
current table (salesreport table). Because I can not
find in the documentation of postgres how to define a
new column into a current table "AFTER A CERTAIN
COLUMN".
on MySQL, I can do easily like this :
"
alter table salesreport add column emoicon(....) after
report;
"
How can I do this on postgres?

Please tell me.

Thank you very much in advance.
--- Michal Taborsky <mi****@taborsky.cz> wrote:
Prabu Subroto wrote:
My boss requested that my application is equipped with
emoicon (smiley) in the sales report. That's why I
need to know, is it possible to save a small image
into the postgres? with which data type should I
define the column (field)?


What do you mean by "equipped with emoicon (smiley)
in the sales
report"? If you are producing some formatted output
from your data
stored in database (HTML, PDF, whatever), I suggest
you add the emoticon
on application level. You can store some
representation of the emoticon
within the text (like ":-)" or ":-(") and then
substitute this text on
application level with the image. If you realy want
to store image data
in database (which I am not sure is a very good
idea), you can use
binary data type, see

<http://www.postgresql.org/docs/7.4/static/datatype-binary.html>.
Something in MySQL like this:
"
alter table salesreport add column emoicon after
report
"
Read the manual on ALTER TABLE command

<http://www.postgresql.org/docs/7.4/static/sql-altertable.html>. You can
do this easily.

--
Michal Taborsky
http://www.taborsky.cz
---------------------------(end of
broadcast)---------------------------
TIP 7: don't forget to increase your free space map
settings



__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3
Prabu Subroto wrote:
I still have problem with a new column into the
current table (salesreport table). Because I can not
find in the documentation of postgres how to define a
new column into a current table "AFTER A CERTAIN
COLUMN".
on MySQL, I can do easily like this :
"
alter table salesreport add column emoicon(....) after
report;
"
How can I do this on postgres?


You can't AFAIK. And you don't want to, either. I guess I know why you
ask about this--you are using "SELECT * FROM table" and then are
accessing "the fourth column". This, however, is bad practice and you
are asking for trouble. Don't count on the database engine to return
columns in any particular order, because the order is not guaranteed
(same as is not guaranteed the order of rows, if you don't specify an
ORDER BY clause.)

You should always specify column names, if your application is accessing
columns according to their position in returned result. You have two
possibilities:

a) Specify exact column names and order in query:
SELECT column1, column2 FROM table
Then it is safe to print $row[0] and $row[1] (in PHP array form, just an
example)

b) Use named columns interface:
SELECT * FROM table
Then in application level use $row['column1'] (again PHP example) -- I
think most languages provide this functionality

--
Michal Taborsky
http://www.taborsky.cz
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #4

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

Similar topics

2
by: Ross Micheals | last post by:
All I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that...
12
by: Vibhajha | last post by:
Hi friends, My sister is in great problem , she has this exam of C++ and she is stuck up with some questions, if friends like this group provides some help to her, she will be very grateful....
1
by: Tony Johansson | last post by:
Hello Experts! I have some questions about inheritance that I want to have an answer to. It says "Abstract superclasses define a behavioral pattern without specifying the implementation" I...
162
by: techievasant | last post by:
hello everyone, Iam vasant from India.. I have a test+interview on C /C++ in the coming month so plz help me by giving some resources of FAQS, interview questions, tracky questions, multiple...
50
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS...
24
by: Kevin | last post by:
Hey guys. I'm looking to get together some VB programmers on Yahoo messenger. I sit at a computer and program all day. I have about 3 or 4 people already, but it would be really cool to have a...
7
by: changs | last post by:
Hi, all I have a asm code, I suspect it sort of socket programming. Can anyone here give some instructions on how to determine the function or give the psudo-code in C? Thanks in advance! ...
3
by: iKiLL | last post by:
Hi all I am building an Windows Mobile 5 forms control in C#, for a Windows Mobile 5 application. I am using CF2.0 and SQL Mobile 2005. The control is a Questions and answer control.
4
by: Mr. X. | last post by:
Hello. I need some help, please. What can an employee ask (technical questions), if I am interviewed of Dot-net developer (also VB.NET and C#). (What are the most general questions, that I may...
30
by: GeorgeRXZ | last post by:
Hi Friends, I have some questions related to C Language. 1What is the difference between the standard C language and Non standard C language ? 2which is better C Lanugage, C under Linux/...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.