Phalanger and mysqli?

Discussion about the open-source Phalanger [?] project.

Phalanger and mysqli?

Postby rundaqvisten » May 7th, 2013, 1:20 pm

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
rundaqvisten
 
Posts: 4
Joined: May 7th, 2013, 1:12 pm

Re: Phalanger and mysqli?

Postby Jakub Misek » May 7th, 2013, 6:15 pm

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2085
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger and mysqli?

Postby rundaqvisten » May 8th, 2013, 6:11 am

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
rundaqvisten
 
Posts: 4
Joined: May 7th, 2013, 1:12 pm

Re: Phalanger and mysqli?

Postby Jakub Misek » May 8th, 2013, 9:14 am

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2085
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger and mysqli?

Postby rundaqvisten » May 10th, 2013, 8:40 am

Ah, I see.
Big thanks for your help! =)

Kind regards
/Mattias
rundaqvisten
 
Posts: 4
Joined: May 7th, 2013, 1:12 pm

Re: Phalanger and mysqli?

Postby Jakub Misek » May 13th, 2013, 8:21 pm

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2085
Joined: January 4th, 2012, 2:42 pm
Location: Prague

Re: Phalanger and mysqli?

Postby KevinAndrewLipscomb » December 27th, 2013, 5:51 pm

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?

Postby Jakub Misek » January 2nd, 2014, 4:59 pm

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,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakubjakub@devsense.com
User avatar
Jakub Misek
 
Posts: 2085
Joined: January 4th, 2012, 2:42 pm
Location: Prague


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 1 guest

cron

User Control Panel

Login

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 89 on October 15th, 2018, 4:06 pm

Users browsing this forum: No registered users and 1 guest
Phalanger