Re: DataObject insert problem
| From: | Ryan King | Date: | Fri, 12 Mar 2004 00:25:08 +0000 |
| Subject: | Re: DataObject insert problem | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11246@lists.php.net to get a copy of this message | ||
MS SQL Server, I think version 7-something, but I'm not at work right now, so I can't say for sure.
Ryan
On Mar 10, 2004, at 10:20 PM, Alan Knowles wrote:
Which database is this? Ryan King wrote:------------------- "In theory, there is no difference between theory and practice. But, in practice, there is. " -Jan L.A. van de Snepscheut http://homepage.mac.com/ryansking/For some reason, the SQL you sent did not work (may not be a SQL server construct). But, here's the script that the Enterprise Manager spit out. CREATE TABLE [dbo].[media] ( [id] [int] IDENTITY (1, 1) NOT NULL , [data] [image] NOT NULL , [created_datetime] [datetime] NULL , [short_description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [type] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , [file_name] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL , [long_description] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] And here's the SQL I used to create the table. CREATE TABLE media (-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comid int IDENTITY (1,1) NOT NULL , data image NOT NULL, created_datetime datetime DEFAULT NULL, short_description varchar(50) DEFAULT NULL, type text NOT NULL, file_name varchar(100), long_description text, CONSTRAINT mediaPK PRIMARY KEY (id)); Thanks, Ryan On Wednesday, March 10, 2004, at 08:58AM, Alan Knowles <alan@akbkhome.com> wrote:Ryan King wrote:--------- http://homepage.mac.com/ryansking/Sorry for the slowness.. Here's my media section: [media] id = 129 data = 257The Generator thinks this is a MySQL TIMESTAMP.. - can you send me the output from SHOW CREATE TABLE media; Regards Alancreated_datetime = 14 short_description = 2 type = 130 file_name = 2 long_description = 2 Thanks, Ryan On Monday, March 08, 2004, at 04:52PM, Norbert Mocsnik <pear-general@mocsnik.hu> wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comHello, Could you send the [media] section from your databasename.ini to the list? Regards, Norbert Ryan King wrote:--------- http://homepage.mac.com/ryansking/$media = DB_DataObject::factory('media'); $media->setId($id); $media->setShort_description($short_description); $media->setLong_description($long_description); if (is_file($_FILES['media']['tmp_name'])) { $media->setType($_FILES['media']['type']); $media->setFile_name($_FILES['media']['name']); $file_path = $_FILES['media']['tmp_name']; $data = file_get_contents($file_path) or die( "Can't open file!" ); $media->setData(base64_encode($data)); } When I then call $media->insert(), the sql that is produced does not include the 'data' field. When I dump the $media object, the encoded file is in the object, but for some reason does not get included in the sql insert statement. I've poked around in the DataObject source, but have not been able to figure out what's going on. -Ryan --------- http://homepage.mac.com/ryansking/-- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php