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

iterating through tables with blob parts

red
I'm probably crazy for even trying this but I'm trying to make a script
that will iterate through my databases, iterate through all the tables,
and show everything on one page in forms that allow me to change the
data when I hit the submit button. Blogs are displayed as links to
image.php?id=$id along with browse buttons so new images can be
uploaded. The idea is to make an idiot proof way for artists to change
their web databases without having to use phpadmin.

Its not that hard when all the tables have ids that are the same. I
simply find the highest id from the first table, then iterate through
the ids and call each table for every id.

$sql="select * from $table where id=$id";

Some of these art graphics are quite large, so I wanted to break them up
for easier downloading. The trouble started when I broke the blobs up
into 64k parts and gave each blob a master id.
for example:
imagemeta image
id=1 id=1 masterid=1
id=2 masterid=1
id=3 masterid=1
id=2 id=4 masterid=2
id=5 masterid=2
This is how it was done at
http://php.dreamwerx.net/forums/viewtopic.php?t=6

However, it seems kind of crazy to me because the image ids have nothing
to do with the imagemeta ids; I can't just iterate through the ids and
assume that all the data in each id corresponds to data in other tables
with the same id.

So I tried it like this:
imagemeta image
id=1 id=1 part=1
id=1 part=2
id=1 part=3
id=2 id=2 part=4
id=2 part=4
This seems crazy too, because you end up with multiple ids with the same
number in the image table.

Either way, it gets pretty complicated. Is there any preferred,
definitive way this should be done ?
Right now I'm working on doing it the first way (above). But here's the
complicate way I have to do it: first,I iterate through the masterids in
the first image table, learn which ids it holds and then iterate through
the other tables while checking to see if each table has a master id. If
it does, I use the master id to call up the image. if it doesn't I use
the ids I found in the first table to call up the metadata.

I can't help thinking there must be a better way. If nothing else, this
has taught me to think in mysqlese.

thanks.


Jul 17 '05 #1
1 2212
red
red wrote:
I'm probably crazy for even trying this but I'm trying to make a script
that will iterate through my databases, iterate through all the tables,
and show everything on one page in forms that allow me to change the
data when I hit the submit button. Blogs are displayed as links to
image.php?id=$id along with browse buttons so new images can be
uploaded. The idea is to make an idiot proof way for artists to change
their web databases without having to use phpadmin.

Its not that hard when all the tables have ids that are the same. I
simply find the highest id from the first table, then iterate through
the ids and call each table for every id.

$sql="select * from $table where id=$id";

Some of these art graphics are quite large, so I wanted to break them up
for easier downloading. The trouble started when I broke the blobs up
into 64k parts and gave each blob a master id.
for example:
imagemeta image
id=1 id=1 masterid=1
id=2 masterid=1
id=3 masterid=1
id=2 id=4 masterid=2
id=5 masterid=2
This is how it was done at
http://php.dreamwerx.net/forums/viewtopic.php?t=6

However, it seems kind of crazy to me because the image ids have nothing
to do with the imagemeta ids; I can't just iterate through the ids and
assume that all the data in each id corresponds to data in other tables
with the same id.

So I tried it like this:
imagemeta image
id=1 id=1 part=1
id=1 part=2
id=1 part=3
id=2 id=2 part=4
id=2 part=4
This seems crazy too, because you end up with multiple ids with the same
number in the image table.

Either way, it gets pretty complicated. Is there any preferred,
definitive way this should be done ?
Right now I'm working on doing it the first way (above). But here's the
complicate way I have to do it: first,I iterate through the masterids in
the first image table, learn which ids it holds and then iterate through
the other tables while checking to see if each table has a master id. If
it does, I use the master id to call up the image. if it doesn't I use
the ids I found in the first table to call up the metadata.

I can't help thinking there must be a better way. If nothing else, this
has taught me to think in mysqlese.

thanks.


writing all that inspired me to get my brain working. I think I figured
it out. I don't have to call the first table and check it. Instead, I
iterate through masterids and check each table for a masterid field. If
it doesn't have one, I use the current masterid as the id for that
table. If it does have a masterid, its an image and I use that master id
to access the blob.

red
Jul 17 '05 #2

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

Similar topics

1
by: Big Red | last post by:
Hi all I am reasonably new at php. I have a database table with three fields, id, caption and data. I have used the id and caption to create a dynamic menu. it just throws it into a loop with...
6
by: Juergen Gerner | last post by:
Hello Python fans, I'm trying and searching for many days for an acceptable solution... without success. I want to store files in a database using BLOB fields. The database table has an ID field...
2
by: Beyonder | last post by:
I have five tables in my database, there are actually NO common fields between them, not even a KEY or ID or anything like that, except for the "body" of a blob field. and that text is not...
2
by: Mathieu Pagé | last post by:
Hi, I already found on the MySQL web site that some users did have good results with tables of some millions records. But, what I want to do is store some hundreds millions records in a...
7
by: Dave Hansen | last post by:
OK, first, I don't often have the time to read this group, so apologies if this is a FAQ, though I couldn't find anything at python.org. Second, this isn't my code. I wouldn't do this. But a...
1
by: NA | last post by:
Is it possible to have adjustable tables (not Access tables per se) but those in Ms Word or Excel based on nexted forms three deep? In other words, if I have a main form, Repair History, both the...
0
by: LuisH | last post by:
Hi, I'm very new on this group. I don't know if this is a old point here. My question is: What is the best way to access Blob rows using C/C++ on PostgreSQL ????? 1) Using ODBC and...
4
by: Claus Konrad | last post by:
Hi What's the better way for retrieving a very large BLOB field from a SQL 2000 (image-field)? I'm currently usign a SqlDataReader, but it times out before all data is retrieved from the table...
16
by: wizard | last post by:
Here is a piece of code below for writing and reading blobs in SQLITE database. I ' ve a problem to read from blob struct called 'Points' Any help would be appreciated Reagards Greg ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.