Re: DataObject insert problem

From: Date: Wed, 10 Mar 2004 15:03:29 +0000
Subject: Re: DataObject insert problem
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11204@lists.php.net to get a copy of this message
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 ( id 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: >> Sorry for the slowness.. >> >> Here's my media section: >> >> [media] >> id = 129 >> data = 257 > >The Generator thinks this is a MySQL TIMESTAMP.. - can you send me the >output from > >SHOW CREATE TABLE media; > >Regards >Alan > > >> created_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: >> >> >>>Hello, >>> >>>Could you send the [media] section from your databasename.ini to the list? >>> >>>Regards, >>>Norbert >>> >>>Ryan King wrote: >>> >>> >>>>$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 >>> >>> >>> >> >> >> >> >> --------- >> http://homepage.mac.com/ryansking/ > > >-- >Can you help out? >Need Consulting Services or Know of a Job? >http://www.akbkhome.com > > > --------- http://homepage.mac.com/ryansking/

« previous php.pear.general (#11204) next »