Loading ...
Sorry, an error occurred while loading the content.

Problem using metaclass in an other class

Expand Messages
  • pierre-henri@wanadoo.be
    Hello, I have quite finish a specific module of metaclass for informix, is someone is interested ? So I have little problem, When I call the class Wanadoo 2
    Message 1 of 6 , Apr 19, 2000
    • 0 Attachment
      Hello,

      I have quite finish a specific module of metaclass for informix, is
      someone is interested ?

      So I have little problem,

      When I call the class Wanadoo 2 times without calling the
      Close methods, the first database id is lost.

      Here under you could find the Constuctor of the class encaplusating
      the Metaclass en the method used to close.

      I'm not very clear but if someone has any idea, I can give more
      explications.

      Thanks


      function Wanadoo ($host=,$user=,$pass=,$db=,$TextAsVarchar=1) {
      global
      $result,$numrow,$hostname,$username,$password,$dbname,$error,$database
      ,$row;

      $hostname = $host; $username= $user; $password = $pass;
      $dbname = $db; $row=0;

      $error = MetabaseSetupDatabase(array(
      "Type"=>"ifx",
      "User"=>$username,
      "Password"=>$password,
      "Persistent"=>"0",
      "Host"=>$hostname,
      "Options"=>array(
      "TextAsVarchar"=>$TextAsVarchar
      )
      ),&$database);

      MetabaseSetDatabase ($database,$dbname);
      return (0);
      }

      function Close() {
      global $database;
      echo "Database_id close: " . $database;
      MetabaseCloseSetup($database);
      }
    • Manuel Lemos
      Hello pierre-henri, ... Sure. Send it over and I ll integrate with the whole Metabase distribution. Anybody with anymore Metabase driver classes, feel free
      Message 2 of 6 , Apr 19, 2000
      • 0 Attachment
        Hello pierre-henri,

        On 19-Apr-00 10:12:11, you wrote:

        >I have quite finish a specific module of metaclass for informix, is
        >someone is interested ?

        Sure. Send it over and I'll integrate with the whole Metabase
        distribution. Anybody with anymore Metabase driver classes, feel free
        to send them over.

        To avoid duplicate work I have a MS SQL driver class that is almost ready
        to be released. I am about to write a Metabase driver class test suite to
        let driver developer verify the conformance of the drivers.


        >So I have little problem,

        >When I call the class Wanadoo 2 times without calling the
        >Close methods, the first database id is lost.

        >Here under you could find the Constuctor of the class encaplusating
        >the Metaclass en the method used to close.

        >I'm not very clear but if someone has any idea, I can give more
        >explications.

        You are using only one $database variable as global variable so in the
        second time the function it is called the variable is is overwritten and
        the first handler value is lost.





        Regards,
        Manuel Lemos

        Web Programming Components using PHP Classes.
        Look at: http://phpclasses.UpperDesign.com/?user=mlemos@...
        --
        E-mail: mlemos@...
        URL: http://www.mlemos.e-na.net/
        PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
        --
      • Pierre-henri Delaval
        Thanks, the global keyword was bad knew by me... Ok, I v noticed something stange.. I establis a connection to the DB and I need to establish a second to get
        Message 3 of 6 , Apr 20, 2000
        • 0 Attachment
          Thanks, the global keyword was bad knew by me...

          Ok,

          I'v noticed something stange..

          I establis a connection to the DB and I need to establish a second to get
          data using data from the first request..

          But, to work clean, I close the connection using all the Metaclass
          interface, it closed both open links....

          I read that ifx_connect called two times only use the first connection id,
          so when I close the second, wich is in fact the same that the first, I lose
          both cursor...


          Is that correct, is that a way to avoid this "stange" behaviour?

          thanks a gain..

          The infomix, class will be soon there..

          The prepare methods was very usefull for using blob in a insert....

          sy
          Pierre-Henri Delaval EuroNet Internet
          Portal Developer A Subsidiary of France Telecom
          http://www.wanadoo.be Lozenberg 22 - 1932 Zaventem
          pierre-henri@... Tel: +32 (0)2 717 18 13
        • Manuel Lemos
          Hello Pierre-henri, ... That seems to be a problem specific of Informix PHP interface functions. Try to establish non-persisten connections to see if the
          Message 4 of 6 , Apr 20, 2000
          • 0 Attachment
            Hello Pierre-henri,

            On 20-Apr-00 07:56:38, you wrote:

            >I'v noticed something stange..

            >I establis a connection to the DB and I need to establish a second to get
            >data using data from the first request..

            >But, to work clean, I close the connection using all the Metaclass
            >interface, it closed both open links....

            >I read that ifx_connect called two times only use the first connection id,
            >so when I close the second, wich is in fact the same that the first, I lose
            >both cursor...


            >Is that correct, is that a way to avoid this "stange" behaviour?

            That seems to be a problem specific of Informix PHP interface functions.
            Try to establish non-persisten connections to see if the problem goes away.
            Anyway, you should report that to the PHP developers maybe by submitting a
            bug report.


            >The infomix, class will be soon there..

            Great. I am about to finish this new release that includes a Metabase
            driver class conformance test. It will help you to verify if the driver
            is consistently implemented. Please, talk to me when you have your
            Informix driver ready so its conformance can be verified.


            >The prepare methods was very usefull for using blob in a insert....

            Yes, but currently there is no explicit BLOB support in Metabase. I am
            considering to added some time in the future, most likely when I have a
            real need for them.


            Regards,
            Manuel Lemos

            Web Programming Components using PHP Classes.
            Look at: http://phpclasses.UpperDesign.com/?user=mlemos@...
            --
            E-mail: mlemos@...
            URL: http://www.mlemos.e-na.net/
            PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
            --
          • k_philippot
            I ve tried to update BLOB in my database with the script given in the metabase tutorial but it seems there is a problem with the MetabaseCreateLOB method. I
            Message 5 of 6 , Jul 25, 2003
            • 0 Attachment
              I've tried to update BLOB in my database with the script given in
              the metabase tutorial but it seems there is a problem with the
              MetabaseCreateLOB method.
              I cannot find this method in the different classes and nothing runs
              after this method.

              I would like to know where to find this method and how to solve my
              problem.
              If you can help I would be gratefull.

              Karine

              My script is here :


              <?php

              include "..\ssl\connection.inc.php";

              //Here follows an example of how to execute a query that updates a
              large object binary field
              //with data retrieved from a file. Make sure that only one row is
              affected by the query because
              //some DBMS are not able to update values of large object fields in
              more than one row per query.


              //Prepare a query to update a row with binary large object field
              (picture).
              $query="UPDATE LANGUES SET IMAGELANGUE=? WHERE
              IDLANGUE=".MetabaseGetTextFieldValue($db->database,"en").";";
              echo $query;

              if(($prepared_query=MetabasePrepareQuery($db->database,$query)))
              {
              //Create a large object handler class to supply data from a
              specified file.
              echo $prepared_query;
              $binary_lob=array(
              "Database"=>$db->database,
              "Error"=>"",
              "FileName"=>"C:\AGNET\images\en2.gif"
              );

              $success=MetabaseCreateLOB($binary_lob,$blob);
              echo "success".$success;
              MetabaseError($db->database);
              //if(($success=MetabaseCreateLOB($binary_lob,$blob)))
              if($success)
              {

              echo "blob créé";
              //Define the binary large object field query parameter value.
              //Specifying the name of the field to update is also necessary for
              UPDATE queries.

              MetabaseQuerySetBLOB($db-
              >database,$prepared_query,1,$blob,"IMAGELANGUE");


              //Execute the prepared query.

              if(!MetabaseExecuteQuery($db->database,$prepared_query))
              {
              echo "query executée";
              $error=MetabaseError($db->database);
              }
              MetabaseDestroyLOB($blob);

              }
              else
              {
              echo "erreur";
              $error=$binary_lob["Error"];
              }
              MetabaseFreePreparedQuery($db->database,$prepared_query);

              }
              else

              $error=MetabaseError($db->database);

              ?>
            • Manuel Lemos
              Hello, ... Do you include metabase_lob.php ? That is where the LOB API is defined. -- Regards, Manuel Lemos Free ready to use OOP components written in PHP
              Message 6 of 6 , Jul 25, 2003
              • 0 Attachment
                Hello,

                On 07/25/2003 09:15 AM, k_philippot wrote:
                > I've tried to update BLOB in my database with the script given in
                > the metabase tutorial but it seems there is a problem with the
                > MetabaseCreateLOB method.
                > I cannot find this method in the different classes and nothing runs
                > after this method.
                >
                > I would like to know where to find this method and how to solve my
                > problem.

                Do you include metabase_lob.php ? That is where the LOB API is defined.

                --

                Regards,
                Manuel Lemos

                Free ready to use OOP components written in PHP
                http://www.phpclasses.org/
              Your message has been successfully submitted and would be delivered to recipients shortly.