473,763 Members | 6,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=$i d 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 2241
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=$i d 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
2194
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 extra html formatting stuff. No problem. The data field is a large blob. The data is a complete html file which comes out of a timing system for race cars, its basically a big table.
6
5706
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 (INT, auto_increment), an ORDER field (INT, for knowing the right order) and a "normal" BLOB field. It is planned to split large files in 64k-parts and sort these parts by the ORDER field. Here's some pseudo code how I wanted to implement this...
2
2606
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 identical, just a portion of that text is identical. each table has 5 fields, all different except the blob, which is called "message", so normally I use something like: select * from table1 where message like '%apple%';
2
5427
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 table. 190 millions to start and maybe a lot more after. Does someone already use MySQL with such a quantity of data ? I was also asking myself how a simple SELECt query like this one below
7
1693
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 colleague did, got an unexpected result, and asked me why. I think I can infer what is occurring, and I was able to find a simple work-around. But I thought I'd ask about it anyway. I've been pushing Python at work for use as a scripting...
1
2490
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 row and columns would grow accordingly. Column Heading: Parts Row Heading: Repair Description In this case, I may only know 25% of the parts when creating the table after
0
1155
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 using SELECT I can use SQLGetData to receive many parts of each Blob.
4
2559
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 field Is there any good approach for obtaining parts of the field (like Reader.GetBytes(...))...??
16
6670
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 #include <stdlib.h> #include <stdio.h>
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7366
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.