All Projects → philip → Mysqlconvertertool

philip / Mysqlconvertertool

A MySQL Converter Tool

Projects that are alternatives of or similar to Mysqlconvertertool

Phpminiadmin
extremely lightweight alternative to heavy phpMyAdmin for quick and easy access MySQL databases
Stars: ✭ 278 (-7.02%)
Mutual labels:  mysql
Mysql
A pure node.js JavaScript Client implementing the MySQL protocol.
Stars: ✭ 16,878 (+5544.82%)
Mutual labels:  mysql
Requery
requery - modern SQL based query & persistence for Java / Kotlin / Android
Stars: ✭ 3,071 (+927.09%)
Mutual labels:  mysql
Spring Boot Mysql Rest Api Tutorial
Building a Restful CRUD API using Spring Boot, Mysql, JPA and Hibernate
Stars: ✭ 279 (-6.69%)
Mutual labels:  mysql
Sql Parser
A validating SQL lexer and parser with a focus on MySQL dialect.
Stars: ✭ 284 (-5.02%)
Mutual labels:  mysql
Quick Error
A rust-macro which makes errors easy to write
Stars: ✭ 287 (-4.01%)
Mutual labels:  conversion
Yclas
Yclas Self Hosted is a powerful script that can transform any domain into a fully customizable classifieds site within a few seconds.
Stars: ✭ 276 (-7.69%)
Mutual labels:  mysql
Color Diff
Implemets the CIEDE2000 color difference algorithm, conversion between RGB and lab color and mapping all colors in palette X to the closest color in palette Y based on the CIEDE2000 difference.
Stars: ✭ 296 (-1%)
Mutual labels:  conversion
Doctor
基于知识图谱的医学诊断系统。Medical Diagnosis System Based on Knowledge Map.
Stars: ✭ 286 (-4.35%)
Mutual labels:  mysql
Length.js
📏 JavaScript library for length units conversion.
Stars: ✭ 292 (-2.34%)
Mutual labels:  conversion
Arcemu
World Of Warcraft 3.3.5a server package
Stars: ✭ 281 (-6.02%)
Mutual labels:  mysql
Typescript Node
📋 TypeScript and NodeJS project template.
Stars: ✭ 282 (-5.69%)
Mutual labels:  mysql
Mysql Tutorial
MySQL入门教程(MySQL tutorial book)
Stars: ✭ 3,247 (+985.95%)
Mutual labels:  mysql
Sqlc
Generate type-safe code from SQL
Stars: ✭ 4,564 (+1426.42%)
Mutual labels:  mysql
Node Orm2
Object Relational Mapping
Stars: ✭ 3,063 (+924.41%)
Mutual labels:  mysql
Egg Mysql
MySQL plugin for egg
Stars: ✭ 276 (-7.69%)
Mutual labels:  mysql
Sqlstring
Simple SQL escape and format for MySQL
Stars: ✭ 286 (-4.35%)
Mutual labels:  mysql
Neard
🎲 Portable WAMP software stack
Stars: ✭ 296 (-1%)
Mutual labels:  mysql
Crud
Relational database library for SQL databases & Go.
Stars: ✭ 296 (-1%)
Mutual labels:  mysql
Naivechat
🎭 本项目是作者小傅哥使用JavaFx、Netty4.x、SpringBoot、Mysql等技术栈和偏向于DDD领域驱动设计方式,搭建的仿桌面版微信实现通信核心功能。课程文章已发布到GitChat专栏,欢迎购买。如果本项目能为您提供帮助,请给予支持(关注、⭐️Star、分享)!
Stars: ✭ 290 (-3.01%)
Mutual labels:  mysql

Introduction

The old MySQL extension (ext/mysql) was deprecated in PHP 5.5 and removed in PHP 7.0.

This tool converts ext/mysql code to ext/mysqli code, as ext/mysqli is the current MySQL extension. There's also PDO_MySQL but this tool does not use that. This tool is not perfect but will help with the conversion.

Alternatively, a quicker and simpler short-term fix is to use a bundled native PHP library such as php7-mysql-shim. Instead of converting code (e.g., mysql_connect() to mysqli_connect()) it uses ext/mysqli to define ext/mysql functions in PHP. Much easier but more of a short-term fix. Although php7-mysql-shim contains PHP 7 in the name, it works with older PHP versions but only if ext/mysql is not installed on your system.

Usage

There are two interfaces: GUI and CLI. Example usages:

Using PHP's built-in web server

For example, in a terminal you might do this:

shell> wget https://github.com/philip/MySQLConverterTool/archive/master.zip
shell> unzip master.zip
shell> cd MySQLConverterTool-master/GUI
shell> php -S localhost:8000

Then, go to http://localhost:8000. From there you can choose to convert a snippet (copy-n-paste), a single file, or a directory. You can choose to convert the files themselves (assuming the web server has rights), make backups, or simply output the code to your browser.

Use CLI

Download as you did above, and here is an example to convert a file named /tmp/my.php

$ cd MySQLConverterTool-master
$ php cli.php -f /tmp/my.php

Execute php cli.php -h to see the available options.

Important Warning

That absolutely NO security checks are performed by the tool which prevent users from trying to read and convert files (e.g. /etc/passwd). Make sure to add security measures, if needed.

Additional Documentation

See the wiki for additional information, including screenshots.

Limitations

With short-open-tag disabled, short tags (<? and <?=) are essentially ignored due to how the tokenizer extension works. So, if you use the likes of <? (instead of <?php) then enable short-open-tag before executing the conversion otherwise that PHP code will be ignored (not converted). For details, see issue #16.

Also, a mysql_result equivelant does not exist in ext/mysqli so you must define mysqli_result. The tool does suggest code for this but it does not insert this definition into your converted markup.

Alternatives

The php7-mysql-shim PHP library defines all mysql_ functions for you, so simply include it (a single PHP file) and your code should work without a need to convert. It uses ext/mysqli and works fine in PHP 5.3 or greater. There are pros and cons to each approach.

Also, consider refactoring your code. Whether you convert your code with MySQLConverterTool or define ext/mysql functions using a library such as php7-mysql-shim, these are considered stop-gap measures until you rewrite your code. For example, your new code will probably use prepared statements.

Other

Although unit tests exist, they were not maintained by the lazy developer here. Perhaps one day, see UnitTests/README.

All forms of feedback is welcome and encouraged! Either as bug reports, feature requests, pull requests, complaints, and so on.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].