We help IT Professionals succeed at work.

store order in a mysql table ?

ItsMe
ItsMe asked
on
hi! i want to save plenty complete order forms in an mysql table. so, how would you solve this ?

i've got a simple stringgrid in delphi, containing the order - product informations. this table must be saved in one field of the mysql table. should i save the order table as csv or stream in the sql table ? what would you do ?
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004

Commented:
i would not do this in this way,

i would create order-specific tables in your database,
and use a tdbgrid for editing

Commented:
if one field i agree add some more varchar fields to the table so order no ,product info etc are seperate,that would keep things more logical/clear and easier to search by later.
I think it will be better to have two separate tables, e.g.

OrderForm table
-=============-
OrderID
Customer
etc.

OrderDetails table
-================-
OrderID (as foreign key, linking to OrderForm's OrderID)
ProductDetails
ProductPrice
etc.

Author

Commented:
maybe my databse has to store up to 1 million orders, then 1 have one million tables. isn't this a little bit too complicated ?
CERTIFIED EXPERT
Top Expert 2004

Commented:
nono,
dragonslayer means two tables, (which i do agree to do so)
which then can contain millions of records, not complcated,
and its a like standard to do so

Author

Commented:
yes, some others told me to do this, too. does anybosy knows zeos dbo ? i don't know how to save the record to the database.

kind regards
ItsMe
CERTIFIED EXPERT
Top Expert 2004

Commented:
no, thats the first time i hear about zeos-db

does it have odbc or ado support?

Author

Commented:
it establishes an direct connection to my mysql server.

check www.zeoslib.org

kind regards
ItsMe
CERTIFIED EXPERT
Top Expert 2004

Commented:
well, ok, a short visit to this site

try a app from scratch
(can't do it myself yet)

set up the tables in your database like dragonslayer describes and
use
a TZXXSqlTable for editing the tables
(seems the easiest method for the first time)

connect to TZXXSqlTable a datasource and to the datasource a tdbgrid and a tdbnavigator

Commented:
zeos uses libmysql dll instead of odbc

i would get the source for lite version of winmysql.
(from winmysql.com i think)
it uses libmysql also and the + for you is it uses a stringgrid for displaying.
to do your updates the syntax is simiar to php:
as an example say you have a db with table called advertisers and 2 fields ,to update use:

INSERT INTO advertisers (field1,field2 )VALUES ('testdata', 'testdata')  

i have zeoslib installed but i ony ever used it with ZDBGrid and normal datasource and Dbnavigator to update.you can do it that way using no code at all only some settings in the object inspector.otherwise you need to look at ZUpdateSQL and ZMysqlQuery to do it manually.

Commented:
wow i had open for 42 mins! :)

well meikl i can say it does work that way with no code required ;-)
though i do find it is easier using the native mysql units
ItsMe:

I have found that you have a great many questions open. Some of them are quite old. Please address them immediately:

http://www.experts-exchange.com/jsp/qShow.jsp?qid=20080809
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20081517
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20110611
http://www.experts-exchange.com/jsp/qShow.jsp?qid=11412679
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20170559
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20172193
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20177907
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20178750
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20179401
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20181503
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20187389
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20187432
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20188151
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20243899
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20250630
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20254819

To assist you in your cleanup, I'm providing the following guidelines:

1.  Stay active in your questions and provide feedback whenever possible. Likewise, when feedback has not been provided by the experts, commenting again makes them receive an email notification, and they may provide you with further information. Experts have no other method of searching for questions in which they have commented, except manually.

2.  Award points by hitting the Accept Comment As Answer button located above and to the left of that expert's comment.

3.  When grading, be sure to read:
http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
to ensure that you understand the grading system here at EE. If you grade less than an A, you must explain why.

4.  Questions that were not helpful to you should be PAQ'd (stored in the database for their valuable content?even if not valuable to you) or deleted. To PAQ or delete a question, you must first post your intent in that question to make the experts aware. Then, if no experts object after three full days, you can post a zero-point question at community support to request deletion or PAQ. Please include the link(s) to the question(s).
CS:  http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
At that point, a moderator can refund your points and PAQ or delete the question for you. The delete button does not work.

5.  If you fail to respond to this cleanup request, I must report you to the Community Support Administrator for further action.

Our intent is to get the questions cleaned up, and not to embarrass or shame anyone. If you have any questions or need further assistance at all, feel free to ask me in this question or post a zero-point question at CS. We are very happy to help you in this task!


thanks!
amp
community support moderator

Author

Commented:
makes sense ;)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.