php-general Digest 10 Apr 2012 02:06:40 -0000 Issue 7768

Topics (messages 317493 through 317500):

Re: insteadof considered harmful
        317493 by: Szczepan Hołyszewski

mssql_bind question
        317494 by: David Stoltz
        317495 by: David OBrien

Script failing on extension_dir
        317496 by: George R Smith

desk top interactive environment
        317497 by: Kirk Bailey
        317498 by: Jay Blanchard
        317499 by: Kirk Bailey

php in windows
        317500 by: Kirk Bailey

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
> See http://us.php.net/manual/en/language.oop5.traits.php and scroll down to
> conflict resolution to see simple example. It is used to resolve method
> naming conflicts when multiple traits are used to emulate multiple
> inheritance.

I have read the manual, and the examples there are precisely my examples of 
insteadof's complete redundancy. Firstly, the manual says:

"To resolve naming conflicts between Traits used in the same class, the 
insteadof operator needs to be used to chose exactly one of the conflicting 
methods."

Why, why, why? Why not just name that "exactly one of the conflicting methods" 
using a fully trait-qualified name? That would be completely unambiguous. It's 
a simple task of choosing one from many, and such a choice can be 
unambiguously encoded by just naming the one, without having to list the 
remaining many. It is really that simple, no strings attached.

Here's the example from the manual:

trait A {
    public function smallTalk() {
        echo 'a';
    }
    public function bigTalk() {
        echo 'A';
    }
}

trait B {
    public function smallTalk() {
        echo 'b';
    }
    public function bigTalk() {
        echo 'B';
    }
}

class Talker {
    use A, B {
        B::smallTalk insteadof A;
        A::bigTalk insteadof B;
    }
}

class Aliased_Talker {
    use A, B {
        B::smallTalk insteadof A;
        A::bigTalk insteadof B;
        B::bigTalk as talk;
    }
}

I've been analyzing these 28 lines of code for months, and I cannot for the 
life of me understand why the same information couldn't be conveyed thus:

/* no changes in the traits */

class Talker {
    use A, B {
        B::smallTalk;
        A::bigTalk;
    }
}

class Aliased_Talker {
    use A, B {
        B::smallTalk;
        A::bigTalk;
        B::bigTalk as talk;
    }
}

All information is there. The insteadof clauses add nothing to the 
interpreter's knowledge of the programmer's intention. They are every last one 
of all the hundred damn percent redundant.

But perhaps there IS a purpose, only the examples in the manual fail to 
demonstrate it?

Szczepan Hołyszewski

--- End Message ---
--- Begin Message ---
Folks,

Having a difficult time using mssql_bind with characters greater than
8000...the database field is set to ntext, and I've also tried
varchar(max), both seem to produce the same results:

If I use:
mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLVARCHAR,false,false,8000);

I get the error:
Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in
D:\Inetpub\wwwroot\folder\mypage.php on line 105

I discovered changing SQLVARCHAR to SQLTXT, and dropping the length of
8000 helps:
mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLTEXT,false,false);

I get no error, but the field is truncated to 8000 characters
regardless.

What is the correct way to use mssql_bind with strings of greater than
8000 characters?

Thanks!
Dave

--- End Message ---
--- Begin Message ---
On Mon, Apr 9, 2012 at 1:42 PM, David Stoltz <[email protected]> wrote:

> Folks,
>
> Having a difficult time using mssql_bind with characters greater than
> 8000...the database field is set to ntext, and I've also tried
> varchar(max), both seem to produce the same results:
>
> If I use:
> mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLVARCHAR,false,false,8000);
>
> I get the error:
> Warning: mssql_bind() [function.mssql-bind]: Unable to set parameter in
> D:\Inetpub\wwwroot\folder\mypage.php on line 105
>
> I discovered changing SQLVARCHAR to SQLTXT, and dropping the length of
> 8000 helps:
> mssql_bind($stmt, '@mgrnotes',$mgrnotes,SQLTEXT,false,false);
>
> I get no error, but the field is truncated to 8000 characters
> regardless.
>
> What is the correct way to use mssql_bind with strings of greater than
> 8000 characters?
>
> Thanks!
> Dave
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
this is a limit in SQL itself not the drivers

http://msdn.microsoft.com/en-us/library/aa258848(v=SQL.80).aspx

Using EXECUTE with a Character String

Use the string concatenation operator (+) to create large strings for
dynamic execution. Each string expression can be a mixture of Unicode and
non-Unicode data types.

Although each [N] '*tsql_string*' or *@string_variable* must be less than
8,000 bytes, the concatenation is performed logically in the SQL Server
parser and never materializes in memory. For example, this statement never
produces the expected 16,000 concatenated character string:

EXEC('name_of_8000_char_string' + 'another_name_of_8000_char_string')

Statement(s) inside the EXECUTE statement are not compiled until the
EXECUTE statement is executed.

Changes in database context last only until the end of the EXECUTE
statement. For example, after the EXEC in this example, the database
context is *master*:

USE master EXEC ("USE pubs") SELECT * FROM authors

--- End Message ---
--- Begin Message ---
All,
I am tying to install php that will talk to the database I us (QM, a pick type 
database). As I 
am new to pdp don’t have much experience in figuring out what the qm_ext_build 
script is
failing.
Thanks for you help in advance.
george

I am trying to run following:
root@dell350:/usr/qmsys/qmphp# ./qm_ext_build
It is failing here with the message after the script.

echo ---
echo get the directory where PHP extension are stored
echo ---
EXTDIR=`php -i 2> /dev/null | grep -i "extension_dir" | cut -d" " -f3`
if [ ! -d "$EXTDIR" ]; then
echo -n -e "\n"
echo ============================================================
echo You need to create the php extensions directory:
echo $EXTDIR
echo ============================================================
echo -n -e "\n"
exit
fi

Error message follows, what does the no mean ?
get the directory where PHP extension are stored
============================================================
You need to create the php extensions directory:
/usr/lib/php5/20090626+lfs no
============================================================

There is a directory which contains (I think) the compiled extensions.
I am unsure where to go from here. Do I create a 
extension_dir and if so where do I put it and do I have
to copy the file currently in 20090626+lfs to it. Also
would have to, I believe, add the extension_dir to
the php.ini file.
Help would be appreciated.
root@dell350:/usr/lib/php5/20090626+lfs# ls -la
total 1688
drwxr-xr-x 2 root root 4096 Apr 9 08:33 .
drwxr-xr-x 5 root root 4096 Apr 8 08:20 ..
-rw-r--r-- 1 root root 62936 Feb 10 08:31 curl.so
-rw-r--r-- 1 root root 95596 Feb 10 08:31 gd.so
-rw-r--r-- 1 root root 20024 Feb 27 2010 idn.so
-rw-r--r-- 1 root root 335288 Jun 1 2010 imagick.so

--- End Message ---
--- Begin Message --- Php would (IMHO) benefit from an interactive desktop application where you can test and experiment with code interactively, instead of "edit, dsave, run, view webpage result, edit...

Python has this; why not php?

--
end

Very Truly yours,
                 - Kirk Bailey,
                   Largo Florida

                       kniht
                      +-----+
                      | BOX |
                      +-----+
                       think


--- End Message ---
--- Begin Message ---
[snip]
On Apr 9, 2012, at 8:38 PM, Kirk Bailey wrote:

> Php would (IMHO) benefit from an interactive desktop application where you 
> can test and experiment with code interactively, instead of "edit, dsave, 
> run, view webpage result, edit...
> 
> Python has this; why not php?
[/snip]

Because you haven't built it yet?

--- End Message ---
--- Begin Message ---
I am not ABLE to create it yet. Anyone else able to?

On 4/9/2012 9:45 PM, Jay Blanchard wrote:
[snip]
On Apr 9, 2012, at 8:38 PM, Kirk Bailey wrote:

Php would (IMHO) benefit from an interactive desktop application where you can test 
and experiment with code interactively, instead of "edit, dsave, run, view 
webpage result, edit...

Python has this; why not php?
[/snip]

Because you haven't built it yet?

--- End Message ---
--- Begin Message --- The edition of php for windows I instaklled does not work. Which flavor of windows php DOES work properly in windows?

--
end

Very Truly yours,
                 - Kirk Bailey,
                   Largo Florida

                       kniht
                      +-----+
                      | BOX |
                      +-----+
                       think


--- End Message ---

Reply via email to