Phalanger and mysqli?
8 posts
• Page 1 of 1
Phalanger and mysqli?
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
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
- rundaqvisten
- Posts: 4
- Joined: May 7th, 2013, 1:12 pm
Re: Phalanger and mysqli?
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,
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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger and mysqli?
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
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
- rundaqvisten
- Posts: 4
- Joined: May 7th, 2013, 1:12 pm
Re: Phalanger and mysqli?
Great!
https://github.com/DEVSENSE/PhalangerMy ... /Extension
This 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,
https://github.com/DEVSENSE/PhalangerMy ... /Extension
This 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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger and mysqli?
Ah, I see.
Big thanks for your help! =)
Kind regards
/Mattias
Big thanks for your help! =)
Kind regards
/Mattias
- rundaqvisten
- Posts: 4
- Joined: May 7th, 2013, 1:12 pm
Re: Phalanger and mysqli?
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,
Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: Phalanger and mysqli?
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.
- KevinAndrewLipscomb
- Posts: 1
- Joined: December 27th, 2013, 5:41 pm
Re: Phalanger and mysqli?
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/PhalangerMySql
Thanks,
For the current state of MySQL extension you can follow https://github.com/DEVSENSE/PhalangerMySql
Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 11 guests