Re: [PHP-DB] Re: oci_bind_by_name, 'Unknown or unsupported datatype given'

2005-08-15 Thread Anton Channing
On 8/10/05, Miles Thompson [EMAIL PROTECTED] wrote:
 At 11:32 AM 8/10/2005, Anton Channing wrote:
 On 8/10/05, Miles Thompson [EMAIL PROTECTED] wrote:
   Anton,
  
   This seems so fundamental I hesitate to suggest it.
   Have you run a script with phpinfo() in it?
   Or apache or httpd with the -l, -V or -t switches?
  
   Miles
 
 Okay, have just run phpinfo, obviously it prints out
 a whole load of stuff, what am I looking for?
 
 I hesitate to do anything with the server.  Unfortunately
 my colleague that deals with the server is on holiday,
 so if the phpinfo output can help, it would be good
 if I can work something out from that.
 
 Also, we are lacking a test server at the moment, so
 the only changes I can make are to the live one... :)
 
 Anton
 
 Please reply to the list ...

My appologies, I accidentally hit 'reply' instead of
'reply to all'.  Not really used to doing mailing lists 
on a gmail account.

 Well, it tells you what PHP has been compiled with, Apache configuration,
 and further down what database support is available.

Okay, yeah, I found all that, everything appears to be enabled.
Unless there is something missing that isn't showing up at
all.

 The reason for running phpinfo() and Apache or httpd with those command
 line switches is that it tells you what support for Oracle is available
 from the web server side. Presumably there are similar functions built into
 Oracle.
 
 Never having used Oracle, I cannot tell you what to look for, but there is
 some basic information here which should help with your diagnosis.

Okay, I will reproduce the phpinfo version in the hope that it will
mean something to someone here.  I'll pick out the sections that
seem relevent to oracle connections...

Thanks for your help
Anton

phpinfo() output:

oci8
OCI8 Supportenabled
Revision$Revision: 1.267 $
Active Persistent Links 0
Active Links0
Temporary Lob support   enabled
Collections support enabled

oracle
Oracle Support  enabled

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Re: oci_bind_by_name, 'Unknown or unsupported datatype given'

2005-08-15 Thread Anton Channing
On 8/15/05, Anton Channing [EMAIL PROTECTED] wrote:
 phpinfo() output:
 
 oci8
 OCI8 Supportenabled
 Revision$Revision: 1.267 $
 Active Persistent Links 0
 Active Links0
 Temporary Lob support   enabled
 Collections support enabled
 
 oracle
 Oracle Support  enabled

Hmm, I've noticed something else about the
problem. I am working with the example
given on: 
http://uk.php.net/manual/en/function.ocibindbyname.php

Which I am attempting to run as a test page.
Obviously I altered the username, password
etc for the connection, and made sure the
schema I used had a 'emp' table in it with
the appropriate columns.

I have noticed however, that the script only
falls over on three oci_bind_by_name calls.
Namely the ones that don't specify a type:

oci_bind_by_name($stmt, :empno, $empno, 32);
oci_bind_by_name($stmt, :ename, $ename, 32);

and

oci_bind_by_name($update, :sal, $sal,  32);

whilst these ones seem to be okay:
oci_bind_by_name($stmt, :rid,  $rowid, -1, OCI_B_ROWID);
oci_bind_by_name($update, :rid, $rowid, -1, OCI_B_ROWID);

Its as if the default type arguement is somehow
invalid?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Re: oci_bind_by_name, 'Unknown or unsupported datatype given'

2005-08-10 Thread Anton Channing
Okay, its seems my problem is actually more fundamental.
I've just tried to run the example from the oci_bind_by_name
documentation on php.net, and get the same error!  The
example doesn't work for me.

I think at this point I need to assume there is something
wrong with the server settings?  Maybe Apache needs
certain configurations in order for this to work?

Anyone have any idea whats causing this?

This is the page with the example I tried to run:
http://uk.php.net/manual/en/function.oci-bind-by-name.php

And this is the output from it:
Warning: oci_bind_by_name() [function.oci-bind-by-name]: Unknown or
unsupported datatype given: 1 in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 28

Warning: oci_bind_by_name() [function.oci-bind-by-name]: Unknown or
unsupported datatype given: 1 in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 29

Warning: oci_bind_by_name() [function.oci-bind-by-name]: Unknown or
unsupported datatype given: 1 in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 41

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 46

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 47

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 46

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 47

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 46

Warning: oci_execute() [function.oci-execute]: OCIStmtExecute:
ORA-01008: not all variables bound in D:\Apache
Group\Apache2\htdocs\test\oci_bind_by_name.php on line 47

On 8/9/05, Anton Channing [EMAIL PROTECTED] wrote:
 I am currently building a php-oracle application for
 the college I work for, and as part of that application
 I have cause to to create some insert/update procedures.
 My best solution for this is to have an input/output
 parameter representing the id of the field that needs to
 updated.  This works fine.

...

 And finally, this is the error I get (including a stack trace):
 An error has occurred and the page has not loaded correctly.
 Please try and refresh/reload 
 the page.  If the error
 persists, then please contact 
 MIS and we will look into
 the problem.
 errno: 2
 errstr: oci_bind_by_name() [a
 href='function.oci-bind-by-name'function.oci-bind-by-name/a]:
 Unknown or unsupported datatype given: 1
 errfile: D:\Apache
 Group\Apache2\htdocs\Learner_Support_Fund\update_equipment.php
 errline: 77

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] oci_bind_by_name, 'Unknown or unsupported datatype given'

2005-08-09 Thread Anton Channing
I am currently building a php-oracle application for 
the college I work for, and as part of that application
I have cause to to create some insert/update procedures.  
My best solution for this is to have an input/output 
parameter representing the id of the field that needs to 
updated.  This works fine.

If the passed id is 0 it performs an insert instead.  This 
is also fine. The procedure creates a new id one higher 
than the current max, and uses that instead. Except for 
I would now like the procedure to return this new id back 
to the php.

After searching for an appropriate way to do this, I came 
across oci_bind_by_name, but all the examples in the 
documentation show this being used in an inwards 
direction only.  I found some outwards ones eventually, 
but they either didn't work, or were for special types like 
BLOBS and ROWIDS.  I can't find a working example 
using a number or other ordinary type.

Here is the simplest one of my procedures:
create or replace procedure welfare.update_equipment
 (
   ue_user in varchar2,
   ue_equip_id in out number,
   ue_stu_code in varchar2,
   ue_lsf_no in number,
   ue_lsf_year in varchar2,
   ue_amount in float,
   ue_method in number,
   ue_notes in varchar2
)
as
   update_time date;
begin
   if ue_equip_id = 0 then
   select
   max(lsf_equipment_id)+1,
   sysdate
   into
   ue_equip_id,
   update_time
   from
   welfare.lsf_equipment;
   else
   select
   sysdate
   into
   update_time
   from
   dual;
   
   update
   welfare.lsf_equipment
   set
   lsf_end_date = update_time
   where
   lsf_equipment_id = ue_equip_id
   and lsf_end_date is null;
   end if;
   insert into
   welfare.lsf_equipment
   (
   lsf_stu_code,
   lsf_no,
   lsf_year,
   lsf_amount,
   lsf_payment_method_code,
   lsf_equipment_id,
   lsf_equipment_notes,
   lsf_user_created,
   lsf_date_created
   )
   values
   (
   ue_stu_code,
   ue_lsf_no,
   ue_lsf_year,
   ue_amount,
   ue_method,
   ue_equip_id,
   ue_notes,
   ue_user,
   update_time
   );
end;

Here is the php that calls it:

$sql=begin 
welfare.update_equipment('$user',:equip_id,'$stu_code',$lsf_no,'$lsf_year',$amount,$method,'$notes');
end;;
//echo $sql; //debug line

//Open Oracle Connection
$db_conn=OCI_new_connect(db,username,password);

$psql = OCI_Parse($db_conn, $sql);
OCI_bind_by_name($psql,equip_id,$equip_id,32);
OCI_Execute($psql) or die(Couldn't execute statement.);

// free resources and close connection
OCI_close($db_conn);

And finally, this is the error I get (including a stack trace):
An error has occurred and the page has not loaded correctly.
Please try and refresh/reload 
the page.  If the error
persists, then please contact 
MIS and we will look into
the problem.
errno: 2 
errstr: oci_bind_by_name() [a
href='function.oci-bind-by-name'function.oci-bind-by-name/a]:
Unknown or unsupported datatype given: 1
errfile: D:\Apache
Group\Apache2\htdocs\Learner_Support_Fund\update_equipment.php
errline: 77 

Stack Trace:
#0  UpdateEquipmentForm-renderError(An error has occurred and the
page has not loaded correctly.
Please try and refresh/reload 
the page.  If the error
persists, then please contact 
MIS and we will look into
the problem., 2, 
oci_bind_by_name() [a
href='function.oci-bind-by-name'function.oci-bind-by-name/a]:
Unknown or unsupported datatype given: 1, D:\Apache
Group\Apache2\htdocs\Learner_Support_Fund\update_equipment.php, 77)
called at [D:\Apache
Group\Apache2\htdocs\includes\pages\base_page.php:148]
#1  UpdateEquipmentForm-error_handler(2, oci_bind_by_name() [a
href='function.oci-bind-by-name'function.oci-bind-by-name/a]:
Unknown or unsupported datatype given: 1, D:\Apache
Group\Apache2\htdocs\Learner_Support_Fund\update_equipment.php, 77,
Array ([user] = dhills,[equip_id] = 0,[stu_code] = 1358  
,[lsf_no] = 9231,[lsf_year] = 04/05,[amount] = 666,[method] =
1,[notes] = testing...,[sql] = begin
welfare.update_equipment('dhills',:equip_id,'1358  
',9231,'04/05',666,1,'testing...'); end;,[db_conn] = Resource id
#24,[psql] = Resource id #25)) called at [D:\Apache