|
In additon to having the URLs seperated by a "," I also need to have then encased in " ' ", so to be processed they need to read be passed onto the RSS parser as 'http://www.url1.com', 'http://www.url2.com', So I changed the code to read as: $feeds = new SimplePie (array ("'".$row['URL']."',")); The problem is that I end up again with the inital error message I was having. It is omitting the "'http:" portion of the URL. The error message is: Warning: file_get_contents(//www.cbssports.com/nfl/teams/syndicate/ARI',) [function.file-get-contents]: failed to open stream: No such file or directory The URL field type is set as TEXT, Collation is latin1_swedish_ci, and the SHOW CREATE TABLE gives: CREATE TABLE `rssfeeds` ( `TeamID` varchar(150) NOT NULL, `URL` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
# ? Dec 7, 2009 06:10 |
|
|
# ? May 30, 2024 06:14 |
|
That seems bizarre, why would it cut out the http:// part? Maybe the code for SimplePie is doing something funny. Can you post that?
|
# ? Dec 7, 2009 11:30 |
|
Got a problem with a stored procedure I'm using to send some HTML email. Here's the relevant part of the code:code:
|
# ? Dec 7, 2009 21:08 |
|
code:
|
# ? Dec 7, 2009 21:49 |
|
That works great, thanks. Why are those null if the query comes back with no results though? I expected them to contain the table with those headers, just no actual data.
|
# ? Dec 8, 2009 17:00 |
|
Wonderbread 2000 posted:That works great, thanks. NULL is not the empty string. Anything plus NULL is NULL.
|
# ? Dec 8, 2009 17:31 |
|
I've got a simple SQLITE table with five columns:code:
code:
code:
Is there a smarter way to rewrite the UPDATE before I hit performance issues?
|
# ? Dec 9, 2009 18:25 |
|
Why would you need a column like that?
|
# ? Dec 9, 2009 18:36 |
|
Yeah, why even store such a column? You could effectively recreate it with a view if you want and then it wouldn't have to be updated every time an item was added or deleted. Or you use that same stored procedure you'd use for the view to just return the table with that column tacked on.
|
# ? Dec 9, 2009 18:41 |
|
Maybe the column CAN be calculated directly through a view/query. I'm dumb and trying to learn! My GoogleFu may also be weak; searching for something that would do the equivalent for SQLite yielded a fairly ugly nested SELECT with COUNT that took 15-20 seconds to run.
|
# ? Dec 9, 2009 19:23 |
|
onionradish posted:Maybe the column CAN be calculated directly through a view/query. I'm dumb and trying to learn! Yes it most certainly be done faster at your application level then at the sql side i assume all you want the the number in sequence of the row?
|
# ? Dec 9, 2009 19:49 |
|
Sprawl posted:Yes it most certainly be done faster at your application level then at the sql side i assume all you want the the number in sequence of the row? If there's no magic SQLite to make that column, I can populate it in the script after the query. Thought there might be some magic code to do bulk updates or within the SQLite query. edit: The olde-tyme flatfile originally contained all data, including this sequence number. It's since been moved to a database so scripts and/or database are needing new capabilities.
|
# ? Dec 9, 2009 20:01 |
|
onionradish posted:All I actually need to add is the row number. Depending on how this gets implemented, there may be some real-time resorting (such as by item_name or reverse date), but the original row values (item_seq) wouldn't need to be re-calculated from the original query. Yes well its very easy at application time to add an incremental index sequence for most OO languages these days. Or maybe you could select insert into a temporary table?
|
# ? Dec 9, 2009 20:09 |
|
I'm still not sold. What are you using this value for?
|
# ? Dec 9, 2009 22:15 |
|
This is a homework question. I'm not looking for you or anyone to do my homework for me, but I do need a push in the correct direction. My final project consists of creating a relational database in mysql. It is a database of publications. Each publication has a list of attributes (id, title, journal, pages, year) and a set of authors. The authors can number from zero to an infinite number per publication. So, how do I go about creating a table which can hold an infinite number of authors? fletcher posted:Sorry, but that is a really dumb question. Go buy an infinite number of hard drives? What class is this? Bah. You're right. I'm just going to say 100 is the max and go from there. I know how to do that. Comatoast fucked around with this message at 00:26 on Dec 10, 2009 |
# ? Dec 10, 2009 00:12 |
Comatoast posted:So, how do I go about creating a table which can hold an infinite number of authors? Sorry, but that is a really dumb question. Go buy an infinite number of hard drives? What class is this for?
|
|
# ? Dec 10, 2009 00:15 |
Comatoast posted:Bah. You're right. I'm just going to say 100 is the max and go from there. I know how to do that. You don't need to say infinite or even 100, just say "arbitrary number of authors" or something. You need three tables, publication, author, and a table to relate the two to each other. If this whole class was about databases and you can't do this by the end of the semester...well...start putting effort into school and stop wasting your parents money?
|
|
# ? Dec 10, 2009 00:31 |
|
Comatoast posted:This is a homework question. I'm not looking for you or anyone to do my homework for me, but I do need a push in the correct direction. This is really easy and i shouldn't give it to you but you sound a little slow, think second normal. CREATE TABLE `publication` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(255) DEFAULT NULL, `journal` varchar(255) DEFAULT NULL, `pages` varchar(10) DEFAULT NULL, `year` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CREATE TABLE `publication_author` ( `id` int(11) NOT NULL AUTO_INCREMENT, `publicationid` int(11) DEFAULT NULL, `author` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
# ? Dec 10, 2009 00:46 |
Sprawl posted:This is really easy and i shouldn't give it to you but you sound a little slow, think second normal. Boooooooo! You should have let him figure this poo poo out.
|
|
# ? Dec 10, 2009 00:48 |
|
code:
edit: Thanks for the help guys. I went with the two table approach and its coming together nicely. Comatoast fucked around with this message at 00:08 on Dec 11, 2009 |
# ? Dec 10, 2009 01:20 |
|
Here are some possible changes to the posted DDL:quote:CREATE TABLE `publications` ( Bad Titty Puker fucked around with this message at 02:38 on Dec 10, 2009 |
# ? Dec 10, 2009 02:34 |
|
How do you increment a sequence in oracle? I need to set aside about 15 numbers in the sequence for my own use I want to set the sequence 15 numbers higher so it doesn't try to use my numbers. My Google-fu is just returning how to create sequences with specific increments :<
|
# ? Dec 10, 2009 21:01 |
|
Wreckus posted:How do you increment a sequence in oracle? I need to set aside about 15 numbers in the sequence for my own use I want to set the sequence 15 numbers higher so it doesn't try to use my numbers. You can either create it with an initial offset of 15, manually increment it 15 times, or alter an existing sequence. Increment it 15 times (or run the 'select from dual' 15 times). code:
code:
|
# ? Dec 10, 2009 21:17 |
|
How do I import the contents of a text file into a specific field of a table in MySQL? I have a bunch of TXT files with descriptions that I need to import to the same fields of multiple records. I can't figure out how to use mysqlimport this way. If mysqlimport is the way to do it. (I can figure out how to write the batch script to import them all. I just can't figure out the syntax to get one file inserted into the field.)
|
# ? Dec 11, 2009 18:45 |
|
Agrikk posted:How do I import the contents of a text file into a specific field of a table in MySQL? Whats in the text files? It sounds like you are going to need some scripting with python or perl or something to do it since you will probably need to escape the data if it has special characters or formatting.
|
# ? Dec 11, 2009 19:04 |
|
Begby posted:Whats in the text files? It sounds like you are going to need some scripting with python or perl or something to do it since you will probably need to escape the data if it has special characters or formatting. It's a long description of the record. Basically a really long text file that'll fit in a MEMO field in my database. At the moment it's just raw text, but I'll go back in and add some html tags to make it readable when it's called from a web page.
|
# ? Dec 11, 2009 21:29 |
|
I am helping with an ecommerce site that will be using a drop-ship supplier. This supplier offers a product feed with 60,000 SKUs for inventory data that is updated every 10 minutes. When a product is discontinued, it disappears from the feed. There are no timestamps for updated products. I'm trying to figure out the best MySQL database design that allows for quick inventory updates every 10 minutes, and also has some sort of mechanism for removing items that no longer appear in the feed. The bad way would be to set all stock to zero before importing and all items that exist in the feed would overwrite with their stock quantities. The problem with that is there are 60k SKUs, and anyone trying to place an order while the feed is processing would get a cart error during checkout. What is the proper way to do this? My goal is to get the lowest possible processing time and avoid 120k SQL queries every 10 minutes, while making sure that discontinued items are removed ASAP.
|
# ? Dec 14, 2009 19:59 |
|
Why don't you just delete the item from the table? If you want to keep a table of product information and also keep track of stock (which may be zero), make a new table. What exactly is the bottleneck here? That seems like such a small table. Anyway, here's a rule of thumb. Anything you do to optimize reads will make writes slower (if you need to do lots of real time writes like Amazon). Conversely, anything you do to optimize writes will make reads slower.
|
# ? Dec 14, 2009 21:41 |
|
I assume you have some sort of transactional table, where you would be able to do something like a lock and a set of crap no? You could start with a lock then and update setting all the inventories to 0 and then run a set of updates for each inventory item with the correct levels and then unlock the table.
|
# ? Dec 14, 2009 22:32 |
|
If you want to avoid recalculating all of the entries you can have a delta table with all of the inventory changes since the last update. If you only sold 3 units of item 'A', you would be able to process the delta table and only update that single row.
|
# ? Dec 14, 2009 22:37 |
|
In the grand scheme of things 60,000 records is nothing and should be able to be processed in 10 seconds or less if you set it up right i have a setup that does this every hour it drops about 250,000 records and inserts them in about 15 seconds.
|
# ? Dec 15, 2009 00:10 |
|
Triple Tech posted:Why don't you just delete the item from the table? If you want to keep a table of product information and also keep track of stock (which may be zero), make a new table. Sprawl posted:I assume you have some sort of transactional table, where you would be able to do something like a lock and a set of crap no? dcallen posted:If you want to avoid recalculating all of the entries you can have a delta table with all of the inventory changes since the last update. If you only sold 3 units of item 'A', you would be able to process the delta table and only update that single row. Or am I just retarded and way over-thinking this? Little Brittle fucked around with this message at 00:18 on Dec 15, 2009 |
# ? Dec 15, 2009 00:12 |
|
Little Brittle posted:What is the proper way to do this? I know that's not really helpful but it's the correct answer to your question.
|
# ? Dec 16, 2009 17:11 |
|
Is there a "cleaner" way to do this? A DB of tracks in which they are children of collections, and in the case of multi-cd albums, each collection is the child of the album collection. I need the root collection for a given track. code:
code:
Carthag Tuek fucked around with this message at 16:39 on Dec 18, 2009 |
# ? Dec 18, 2009 16:01 |
|
I have a sort of table of contents I need to pull from the database and order it by page ascending, however page is a varchar because some page items appear in the prefix on pages numbered with roman numerals, so a simple code:
code:
|
# ? Dec 19, 2009 01:04 |
|
ORDER BY PAGE REGEXP '[a-zA-Z]+' DESC, PAGE
|
# ? Dec 19, 2009 02:28 |
|
Carthag posted:Is there a "cleaner" way to do this? I would say that Tracks, Albums, and Collections are different entities and would look into storing them in separate tables. If there is a many-to-many relationship between Tracks and Albums, or Albums and Collections, I would look into making tables for those as well. So getting the collection that contains an album that contains a track is straightforward normal joins.
|
# ? Dec 19, 2009 07:23 |
|
Lamb-Blaster 4000 posted:I have a sort of table of contents I need to pull from the database and order it by page ascending, however page is a varchar because some page items appear in the prefix on pages numbered with roman numerals, so a simple If you need the roman numerals to sort in their order (I, II, III, IV, etc.) you may want to create a lookup table that contains the roman numeral (unique) and the sort key (unique, starts with 1, increases monotonically). Do an outer join on the numeral and add an offset to the sort key so the Roman numerals come after the Arabic ones.
|
# ? Dec 19, 2009 07:27 |
|
camels posted:I would say that Tracks, Albums, and Collections are different entities and would look into storing them in separate tables. If there is a many-to-many relationship between Tracks and Albums, or Albums and Collections, I would look into making tables for those as well. So getting the collection that contains an album that contains a track is straightforward normal joins. Not an option, I should say that this is not my own database. I'm just looking for a better query.
|
# ? Dec 19, 2009 13:02 |
|
|
# ? May 30, 2024 06:14 |
|
Hammerite posted:ORDER BY PAGE REGEXP '[a-zA-Z]+' DESC, PAGE Agh, I only just realised this won't sort the roman numerals properly. Yeah, better just go with some variation on what camels said.
|
# ? Dec 19, 2009 15:31 |