Page 1 of 1
Phalanger and mysqli?
Posted:
May 7th, 2013, 1:20 pm
by rundaqvisten
I am trying to port 3 large php-projects into C# and thought Phalanger is a nice possibility to take it step by step instead of re-writing it all from scratch.
But I ran in to a problem. The projects are using mysqli, and I don't know how to make this work with Phalanger. Currently, my project casts an exception when I call the mysqli_init()-method.
I have googled it for hours and can't seem to find any info about it.
Does anyone know how I should solve this?
Help is much appreciated =)
/Mattias
Re: Phalanger and mysqli?
Posted:
May 7th, 2013, 6:15 pm
by Jakub Misek
Hello,
MySQLi extension still has to be implemented. (there are MySQL, PDO MySQL, SQLite, MSSQL so far).
MySQLi is an extension to MySQL. So it contains just a little of new functionality, therefore it should be easy to implement. Do you have any knowledge of C#?
Thanks,
Re: Phalanger and mysqli?
Posted:
May 8th, 2013, 6:11 am
by rundaqvisten
Thanks for your answer!
Yes, C# is my "main" language. I googled some more yesterday on writing an "extension" in C# and implementing "global" methods (so I can seamlessly use "mysqli_init()" in the old code and do not have to rewrite the PHP-code).
I have tried to create a new project called PHP.Library (with namespace PHP.Library) with a test-function inside with the attribute [PHP.Core.ImplementsFunction("my_test")]. Also added a reference to the dll in web.config (<add url=".."/>), but my_test() is not declared.
Is this possible? And, do you think this is the correct approach, or should I take another angle on it?
Kind regards
/Mattias
Re: Phalanger and mysqli?
Posted:
May 8th, 2013, 9:14 am
by Jakub Misek
Great!
https://github.com/DEVSENSE/PhalangerMy ... /ExtensionThis is the MySQL extension. In addition to [ImplementsFunction] attribute, you also have to provide [assembly: PhpLibrary] attribute (see AssemblyInfo.cs, note the first argument can be simply null).
Without this assembly-wide attribute, [ImplementsFunction] attributes are not used at all, and all the classes and methods are accessible thru their C# name.
Thanks,
Re: Phalanger and mysqli?
Posted:
May 10th, 2013, 8:40 am
by rundaqvisten
Ah, I see.
Big thanks for your help! =)
Kind regards
/Mattias
Re: Phalanger and mysqli?
Posted:
May 13th, 2013, 8:21 pm
by Jakub Misek
I would suggest to fork the PhalangerMySQL project on GitHub. In this way we can share, and I can comment and help with your code by commenting commits and suggesting fixes.
Thanks,
Re: Phalanger and mysqli?
Posted:
December 27th, 2013, 5:51 pm
by KevinAndrewLipscomb
Has anyone made any progress implementing mysqli for Phalanger? I would ask that you guys give it a higher priority since it's now one of the recommended MySQL APIs and in some respects it's more robust than PDO.
Re: Phalanger and mysqli?
Posted:
January 2nd, 2014, 4:59 pm
by Jakub Misek
mysqli is almost identical to mysql, functions are just called differently.
For the current state of MySQL extension you can follow
https://github.com/DEVSENSE/PhalangerMySqlThanks,