473,495 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Updating databases

Hi,
Firstly, Im a solo applications developer who's only database development
experience has been this project.
I've been developing a small MySQL client/server application and, to date,
when there have been table changes an installation engineer uses my small
database utility on-site to compare old and new versions making any
structural changes manually.
My company have decided they want the process to be done automatically
during installation.
I thought of running a pre-created script to create a temporary database,
import the old data into the new, destroy the old, rename the temp one.
Beyond that, Im a bit stuck knowing what's possible and where it should be
done.
I think I have a choice between creating a script or doing it via code.
My main application uses MySQL's ADO.net connector components and I'm
comfortable using these, but I don't know how to disable constraints while I
do the import using sql queries.
Creating a script worries me because I don't feel I have enough xp, above
studying MySQL Administrators script generation, on what should be put into
a script. I also don't know at the moment how data is written to a script
for BLOB fields eg images.
Would someone advise me please.
Thank you :)

Jun 27 '08 #1
2 953
01: Backup DB
02: Check the DB version number (you could have a single row in a table with
a number in it)
03: Run all scripts from that version up to the current version

if (version < 2)
upgradetov2;
if (version < 3)
upgradetov3;

etc
Pete
Jun 27 '08 #2
Hi Claire,

Will your app have access to both databases? If they are both in the same
format, that certainly helps!

In your installer, create two DataAdapters and two DataTables. Fill each
DataTable with its DataAdapter's Fill method, then start going through a loop:

for (int i = 0; (i < MyDataTable.Rows.Count) && (i <
TheirDataTable.Rows.Count); i++)
{
for (int j = 0; j < ColumnsInTable; j++)
{
if (MyDataTable.Row[i][j] != TheirTable.Row[i][j])
{
// Update whatever table you want to keep
}
}
}

Note: The code above is untested. Row[i][j] will return an object, and I
haven't tried comparing objects like that.

Hope that helps!
Jun 27 '08 #3

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

Similar topics

11
16069
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
3
2765
by: Robin Tucker | last post by:
Hi there, I have a database on my test machine that will need to be installed on users machines. I would like to create the database with the given schema on the users machine and also with...
1
1498
by: Chuckles | last post by:
Ok I am attempting to build a training database that records the employees training required vs. training received. My problem lies in the fact that the jobcode(s) assigned to that employee ...
5
2050
by: aaron.m.johnson | last post by:
I have an application which contains an Access database with linked tables that point to another database within the application. The problem I have is that when the user installs the application,...
33
3254
by: bill | last post by:
In an application I am writing the user can define a series of steps to be followed. I save them in a sql database using the field "order" (a smallint) as the primary key. (there are in the range...
0
7196
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
7373
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
5456
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,...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1405
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
649
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
286
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.