Menu

#9 Compilation error under php 5

sqlb_php_module
open
5
2014-08-01
2005-02-17
livingdead
No

Hello

I see that there is no update for php 5.

I have a project which need to support huge single
writing in database simultaneous. I found your solution
very good.

But when I tried to compile it in php it shown several
errors.

Could you fix it or giving me the way to do.

I'm not at all C developper but maybe, I could try.

I really need it.

thanks in advance

regards

David

Discussion

  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    Hi David,

    First, thanks for choosing sqlb.

    For the moment, I don't have any php5 installed anywhere
    so I'm not able to port it by myself. But if you send me the
    error output you have when you tried to compile the php
    module with php5, I can try to help you solving your problem.

    waiting for your feedback,

    Best regards,

    GrumZ

     
  • livingdead

    livingdead - 2005-02-17

    modified file

     
  • livingdead

    livingdead - 2005-02-17

    Logged In: YES
    user_id=1180261

    Hello Grumbz

    And before thanks to you for your developpement and to support it yet.

    I try to modified the file myself, and it as compiled but I made it as I
    could comparing other c file in php ext directory. It's seems to have
    compiled, but i'm not sur at all it works

    I send you the file I modified to see If you are seeing errors.

    But It seems that a lot of thinks have change with php5 in the treatment
    of the arguments and on the errors management.

    If you need I could try to make a another compilating directory with your
    sources not modified and to send you the error trace.

    thanks again

    david

     
  • livingdead

    livingdead - 2005-02-17

    the other file

     
  • livingdead

    livingdead - 2005-02-17

    Logged In: YES
    user_id=1180261

    Again me

    As It's seems that it does not work. I did what I wrote to you before.
    so when compiling with php 5.0.3 the folowing message arise :
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: `BYREF_NONE'
    undeclared here (not in a function)
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: initializer element is not
    constant
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: (near initialization for
    `argument_type[1]')
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: initializer element is not
    constant
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: (near initialization for
    `argument_type[2]')
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: initializer element is not
    constant
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: (near initialization for
    `argument_type[3]')
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: `BYREF_FORCE'
    undeclared here (not in a function)
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: initializer element is not
    constant
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: (near initialization for
    `argument_type[4]')
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: initializer element is not
    constant
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:42: error: (near initialization for
    `argument_type[5]')
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:44: warning: initialization from
    incompatible pointer type
    /root/php-5.0.3-buggy/ext/sqlb/sqlb.c:59: warning: initialization makes
    integer from pointer without a cast
    make: *** [ext/sqlb/sqlb.lo] Erreur 1

    As you'll see in the files I modified it seem that the declaration :
    startic unsigned char argument_type[] = { 5, BYREF_NONE,
    BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_NONE };

    is not right under php5 they use a syntax as I remplaced in the c file. but
    they surely change the method to retreive vars too, I don't know.
    I found in their files the following description :
    if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,&domain,
    &map) == FAILURE) {
    WRONG_PARAM_COUNT;
    }

    and for errors :

    if\(\(YP\(error\) = yp\_order\(Z\_STRVAL\_PP \(domain\), Z\_STRVAL\_PP
    

    (map), &outval))) {
    php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
    yperr_string (YP(error)));
    RETURN_FALSE;
    }

    but I don't know where (YP(error) come from ???

    when I compile it as modules the folowing message arise :
    Configuring for:
    PHP Api Version: 20031224
    Zend Module Api No: 20041030
    Zend Extension Api No: 220040412
    configure.in:9: warning: underquoted definition of
    PHP_WITH_PHP_CONFIG
    run info '(automake)Extending aclocal'
    or see http://sources.redhat.com/automake/automake.html#Extending-
    aclocal
    configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
    configure.in:33: warning: underquoted definition of PHP_EXT_DIR
    configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
    configure.in:35: warning: underquoted definition of
    PHP_ALWAYS_SHARED
    acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C
    acinclude.m4:1915: warning: underquoted definition of
    PHP_TEST_BUILD

    It's all my help. And the research I made. but after I compiled the
    folowing message arise when I try you example file :
    Now I put a simple example that use these functions : Execute an insert
    query :

    Error(-1) :

    array(1) {
    ["failed"]=>
    string(241) "[Error] : init_ipc_ressources : Database type and/or name
    wasn't specified in arguments..
    [Error] : Error during IPC ressources init.
    [Error] : Can't init request.
    [Error] : clean_up : shmdt - Invalid argument.
    [Error] : Can't clean result.
    "
    }
    Erreur !

    ??????

     
  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    The output that sqlb module give you make me think that it
    may works . At least, the php module manage to contact the
    sqlb client library.

    Did you set the global variable as it is described in the
    comment of the function wrapper in the example script :

    /!\ ATTENTION /!\ : you must set globally the name and type
    of your DB from SQLB config <type@name> respectively in vars
    $sqlb_base_name and $sqlb_base_type (type are "mysql",
    "oracle" and "pg")

    If it is the case did you manage to make sqlb works before
    you try to make it run with php5 ?

    for example try this command line from a terminal with a
    user that belong to the sqlb user group (apache or nobody
    generally)

    # sqlbclient -t type -n name -q "select 1"
    => where "type" is mysql/pg/oracle and "name" is the name of
    the connection in your config file

    with mysql as type, it should return something like :
    1
    [0][0] 1

    you also can try a real query.

    Waiting for your feedback...

     
  • livingdead

    livingdead - 2005-02-17

    Logged In: YES
    user_id=1180261

    you 're right I mistake the global variavles I declare two times the same.
    And I was confuse on the name of the database. thanks for your help.

    I still have a little probleme which is strengh. Now I got the following
    message, It's seem to be more a sql problem, but it seem I check and I
    don't understand :
    Error(0) de exec_other:

    insert into Test (ID, Name, Desc) values ('0', 'toto', 'teste')

    array(1) {
    ["failed"]=>
    string(80) "[Error] : ERREUR: erreur de syntaxe sur ou prs de Desc
    at character 29
    .
    "
    }
    Erreur ! dans l'insert

    la structure de la table est la suivante :
    Name Test
    Colonne Type Not Null
    ID integer
    Name character varying(30)
    Desc character varying(250)

    Am I idiot ? sometime it could

    thanks for all you quick help

    david

     
  • livingdead

    livingdead - 2005-02-17

    Logged In: YES
    user_id=1180261

    It's seem not comming from sql in fact :
    I comment the insert instruction and I got the following message on the
    insert :
    Error(0) de select :
    select ID, Name, Desc from Test

    array(1) {
    ["failed"]=>
    string(80) "[Error] : ERREUR: erreur de syntaxe sur ou prs de Desc
    at character 18."}
    Erreur ! erreur dans le select

    Misterious isn't it ?

    Oh just for information I had insert a value for test in the database.

    david

     
  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    Hello again,

    I tried to grep the error message in my code, but it
    doesn't seem to come from here.
    Are you a french speaking guy ? Because if it is the
    case, then the message should come from your mysql server,
    and if it is the case, the error should come from the fact
    that "desc" is a mysql keyword that is used to have the
    description of a table. for example, let's try :

    desc Test;

    So try to rename your field with another name to see if it
    solve the problem.

     
  • livingdead

    livingdead - 2005-02-18

    Logged In: YES
    user_id=1180261

    I'm sorry for this last post. I could think to that too.

    You're right, but I would like to indicate nicely, that It was you who wrote
    in your test file the field Desc in the table Test Grrrrrrr :D

    I'm very happy your system works very fine. I do not stress it yet.

    Do you have some bench or do you find some limitation, or some thinks
    that must not be done to get the best result.

    I need to manage a maximum of 50 000 transaction per second.

    As I'm not a business angel. So I use only mysql and postgres to do it.

    I thought that the better way is to mysql for the logging (only writing) in a
    heap memory table.
    Then I will dump and empty the mysql table and put all lines in the
    postgresql tables and to resolve the consctraint.

    And then all operation will be manage by postgres procedure trigger etc..
    .

    Thanks for any suggestion.

    I thanks you for all the help you gave me.

    david

     
  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    Hi again,

    I'm happy that it works well for you. I'm really sorry to
    have muddle you up with my bad example :o)

    For the performance issue, I primarily developped sqlb for
    my former employer to deal with web site that received huge
    access.
    At that time we had some limitation with mysql that tend to
    loose its performance passed a certain amount of load but it
    was back in 2000 so I think that the new version are far
    better. We obtain the best performance with Oracle because
    of its heavy connection protocol that cost a lot if you
    connect/disconnect all the time, so the persistant
    connection improve a lot. For mysql, the performance is
    better mostly when the database is distant (on a different
    server).
    I can't say if you could deal with the amount of request you
    need with sqlb but It used to deal with big amount of request.
    The timeout system I use to deal with connection problem to
    the database is not very reliable because when a timeout is
    reported you can't be sure that the request has not been
    processed, so if you intend to make lots of modification
    request (insert, update, etc), maybe it is not a good idea
    to use sqlb. On the other hand, it is perfect for 'select'
    query.

    For tips to improve the performance, lets check my Tips'n
    Trick tracker :

    https://sourceforge.net/tracker/?atid=399617&group_id=28058&func=browse

    If finaly you are not satisfied with sqlb, let's have a look
    at SqlRelay that is for more advanced than sqlb but, as a
    counterpart, much more complicated to implement ;o)

    Hope it will satisfy your needs,

    Best regards,

    GrumZ

     
  • livingdead

    livingdead - 2005-02-21

    Logged In: YES
    user_id=1180261

    Hello

    Thanks for your informations.

    I've one last question, do you know a system pemitting me to
    make huge load testing.

    a way to send a number of simultaneous query, to improve
    the system.

    Thanks

    david

     
  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    No I don't.

    The only solution that I can give to you is to use the sqlb
    perl module and generate a little script that send a huge
    number of query. Then launch several one in background with
    a '&'
    you can add the 'time' command to know how much time it last :

    time my_load_script.pl &

    or you can directly use the command sqlbclient in a bash
    script too.

     
  • livingdead

    livingdead - 2005-02-23

    Logged In: YES
    user_id=1180261

    Hello from a long time

    So I tryed SQLRelay, as you indicate to me.

    I had several difficulties to make it working (bug in php pear module).

    And I make test (Aie)

    I use http_load to load with 1000 simultaneous user during 30 s.

    SqlRelay was able to load at maximum 628 insert.

    And your little software HAS BEEN ABLE TO INSERT 9020, in the
    same laps.

    YUUUUUUUUU

    So I think I ll keep your software, the only problem I meat with your
    solution is to get the 'LAST_INSERT_ID()', as the connection is
    balanced this is never the same ID, but it's not a matter as I do not need
    to manage it cause I use mysql only as log table.

    If You have more innformation for me, thanks in advance

    Regards

    david

     
  • Frédéric RUAUDEL

    Logged In: YES
    user_id=226667

    I'm happy to learn that sqlb is such efficient, thx ;o)

    for your problem with last_insert_id(), the problem is
    already fixed. In fact, when you do an insert with sqlb, the
    last inserted id is returned as a result of your request.
    You must use the exec_select () wraper function to retrieve
    it. IIRC, the field is named 'id'.
    You can verify this by trying to execute an insert query
    with the command line sqlbclient program. It will display
    the id in its output.

    But as I said earlier, be careful with insert and other
    modification query with sqlb because of the timeout problem.

    If you have other question, feel free to ask...

    Have a nice day,

    GrumZ

     

Log in to post a comment.

Auth0 Logo