Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,234 members, 7,825,904 topics. Date: Monday, 13 May 2024 at 05:48 AM

DHTMLSQL - A Very Advanced Wrapper For Mysql Database! - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / DHTMLSQL - A Very Advanced Wrapper For Mysql Database! (6702 Views)

Android Quiz App With Php And MYSQL Database / Web Development And Programming Using PHP/MYSQL Database At Yemlat / Most Used Mysql Database Functions (2) (3) (4)

(1) (2) (3) (4) (Reply) (Go Down)

DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 3:11am On Jan 17, 2016
You are a looking at An advanced, compact and lightweight MySQL database wrapper library, built around PHP's mysqli extension.
It provides methods for interacting with MySQL databases that are more powerful and intuitive than PHP’s default ones.

Features
* It uses the mysqli extension for communicating with the database instead of the old mysql extension, which is officially deprecated as of PHP v5.5.0 and will be removed in the future; again, this is not a wrapper for the PDO extension which is already a wrapper in itself
* It offers lots of powerful methods for easier interaction with MySQL
* It provides a better security layer by encouraging the use of prepared statements, where parameters are automatically escaped.
* It has comprehensive documentation and examples of usage included
* It allows easy ways of backing up and restoring your database.

Installation and Usage
View project on github https://github.com/dhtml/dhtmlsql
Download the archive from https://github.com/dhtml/dhtmlsql/archive/master.zip (plenty sample codes inside)
It is also available on composer - https://packagist.org/packages/dhtml/dhtmlsql
Full document available on - http://dhtml.github.com/dhtmlsql

** Note: the source code is heavily documented.

Connect to a database

require "dhtmlsql.php";
// Connection data (server_address, name, password, database)
$db=DHTMLSQL::connect('localhost','admin','pass','dbtest');

SELECT statement
$db->select(
'column1, column2',
'table',
'criteria = ?',
array($criteria)
);
while ($row = $db->fetch_assoc()) {
// do stuff
}

INSERT statement
$db->insert(
'table',
array(
'column1' => $value1,
'column2' => $value2,
)
);

An UPDATE statement
$db->update(
'table',
array(
'column1' => $value1,
'column2' => $value2,
),
'criteria = ?',
array($criteria)
);


For full documentation - http://dhtml.github.com/dhtmlsql

7 Likes

Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by romme2u: 3:03am On Feb 13, 2016
does it sanitize input parameters to avoid sql injection. like u said "it encourages the use of prepared statement", should it encourage or enforce it.

does it supports transaction, stored procedure and views.

do u have plans of providing an easy to use and robust interface for mysql trigger and events.

since it is a wrapper, is the library optimized for faster execution like using persistent connection since it is stacked on top mysqli extension

i love the initiative and the time u have invested to produce this but i hope with some of the question above, u can improve it if the issues there have not been considered.

Note: i have not assess it yet but would do so soon to see if we can work on improvement.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 3:25am On Feb 13, 2016
It automatically sanitizes statements, but you can still use the regular prepared statements in MySQLi if you like.

$db->insert('users',
array('first'=>'Tony','last'=>'Ogundipe')
); //this will automatically prepare internally

Persistent connection is MySQLi has to do with you putting "p:" in front of your hostname in your connection e.g. p:localhost will give you persistent connection.
As for the triggers, the trigger has nothing to do with the wrapper, you can use triggers if the database server does not have it disabled. Some of these small hosts we use disable the use of triggers, so I dont really base my apps.

The database object automatically supports every known features of MySQLi. Just think of it like jQuery being a wrapper for javaScript. Just that it provides you with alternative ways of doing the same thing. It has a complete API documentation as well as basic documentation.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by ChinenyeN(m): 6:15am On Feb 13, 2016
This is nice. Good job seeing this through.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 6:56am On Feb 13, 2016
Boss DHTML...
I sight yu Sire.. Nice Work..
When will i grow up like yu in Programming..!!
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 4:54pm On Feb 13, 2016
Thank you very much people.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by FincoApps(m): 5:28pm On Feb 14, 2016
So better people still dey NL ehnnn
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 6:48pm On Feb 14, 2016
You no surprise reach me o.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by FincoApps(m): 7:38pm On Feb 14, 2016
dhtml18:
You no surprise reach me o.
na u I dey talk about na....I no know say u know book o
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 7:46pm On Feb 14, 2016
I be olodo jor, why you think say i sabi book?
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by FincoApps(m): 6:08pm On Feb 15, 2016
dhtml18:
I be olodo jor, why you think say i sabi book?

You know na. When u dey create apps for developers (not users). That means users are too dumb for u na
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by ari3l(f): 7:47am On Feb 16, 2016
@dhtml,what vulnerability scanner did u use to test run for bugs and sql injection
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 9:18am On Feb 16, 2016
FincoApps:


You know na. When u dey create apps for developers (not users). That means users are too dumb for u na
Na you sabi.

ari3l:
@dhtml,what vulnerability scanner did u use to test run for bugs and sql injection
Jamb question. I have no suitable answer to give, but i do know that it is not susceptible to sql injection with proper usage.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by ari3l(f): 9:28am On Feb 16, 2016
dhtml18:

Na you sabi.


Jamb question. I have no suitable answer to give, but i do know that it is not susceptible to sql injection with proper usage.

Hmm first of all, you should use something like aucentix vulnerability scanner or vega vulnerability scanner to scan or if you have kali linux u can use the scanner to scan as well if you want someone to use your wrapper. Sql injection is delicate, and needs time to tackle something like that. If an attacker reaches out to your database, don't you think he can compromise everything for his own selfish gains? I used simple sql injection to hijack some site that sells e-currency and email thier pass to them,even the salt /md5 decrypted password

Maybe you haven't also figured out that php is susceptible to flaws like LFI,RFI, sqli and the likes,then when developing u would have a change of mind and learn to bulletproof your web application

Thanks to gimakon, he knows what he's really doing.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 9:31am On Feb 16, 2016
jQuery is a wrapper for javaScript. As far as i am concerned, it has all the weaknesses of javaScript, for example, if you turn off javaScript in the browser, jQuery will no longer work. Then you can now start talking about graceful degradation.
Now tell me, should the maker of jQuery start adding graceful degradation to part of the jQuery library? Not at all!

My library provides a wrapper for MySQLi, and it is even more secure than using MySQLi directly (in case you have not noticed). However, security goes beyond (input santization etc) using stuffs like prepared statements (which my library does flawlessly).

Instead of all these big talks, prove that my library can be flawed by basic sql injection.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 12:05pm On Feb 16, 2016
dhtml18:
You are a looking at An advanced, compact and lightweight MySQL database wrapper library, built around PHP's mysqli extension.
It provides methods for interacting with MySQL databases that are more powerful and intuitive than PHP’s default ones.

Features
* It uses the mysqli extension for communicating with the database instead of the old mysql extension, which is officially deprecated as of PHP v5.5.0 and will be removed in the future; again, this is not a wrapper for the PDO extension which is already a wrapper in itself
* It offers lots of powerful methods for easier interaction with MySQL
* It provides a better security layer by encouraging the use of prepared statements, where parameters are automatically escaped.
* It has comprehensive documentation and examples of usage included
* It allows easy ways of backing up and restoring your database.

Installation and Usage
View project on github https://github.com/dhtml/dhtmlsql
Download the archive from https://github.com/dhtml/dhtmlsql/archive/master.zip (plenty sample codes inside)
It is also available on composer - https://packagist.org/packages/dhtml/dhtmlsql
Full document available on - http://dhtml.github.com/dhtmlsql

** Note: the source code is heavily documented.

Connect to a database



SELECT statement


INSERT statement


An UPDATE statement



For full documentation - http://dhtml.github.com/dhtmlsql
Bro sorry to say you have a very non descriptive name for your library. The name dhtmlsql is very misleading. Also i dont see any improvement in what you have made, what real problems has this new library solved? Its not an ORM and i have checked your code, its not as efficient as some similar libraries. Though i know this is a work in progress,it makes more sense to solve problems people actually face than trying to reinvent the wheel rather poorly. grin
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 12:12pm On Feb 16, 2016
The thing is that I truly doubt if some people on this thread have enough brains to understand what this stuff is really about, contrary to their big talks.
A person can look at a code and not really understand what it does, or how it does what it does - their is that in programming. It takes a programmer with real brains to truly understand my codes even with all the documentations.
So seunthomas, i truly understand your pains, but unfortunately, I cannot help you. So my strong advice to you is that you do not use this library - use the better ones you know of or better still, build your own.

Saying a wrapper is trying to re-invent the wheel means that you truly do not understand what you say. jQuery is trying to re-invent the wheel too because it is still javaScript in your own words right?

#My respect for you has dropped by 99% by this your very interesting statement. I know you are trying to simply act annoying/jealous as usual, but you have done it in a way that actually makes you look like a learner (i still believe you have more brains than this, but i might be wrong).

Before you start any e-fight, please post the link to your github make we inspect am to see your contributions to the open-source world. But if you dont/cannot, then you have no right to criticize or even comment on this thread (so says i).

1 Like

Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 12:57pm On Feb 16, 2016
dhtml18:
The thing is that I truly doubt if some people on this thread have enough brains to understand what this stuff is really about, contrary to their big talks.
A person can look at a code and not really understand what it does, or how it does what it does - their is that in programming. It takes a programmer with real brains to truly understand my codes even with all the documentations.
So seunthomas, i truly understand your pains, but unfortunately, I cannot help you. So my strong advice to you is that you do not use this library - use the better ones you know of or better still, build your own.

Saying a wrapper is trying to re-invent the wheel means that you truly do not understand what you say. jQuery is trying to re-invent the wheel too because it is still javaScript in your own words right?

#My respect for you has dropped by 99% by this your very interesting statement. I know you are trying to simply act annoying/jealous as usual, but you have done it in a way that actually makes you look like a learner (i still believe you have more brains than this, but i might be wrong).

Before you start any e-fight, please post the link to your github make we inspect am to see your contributions to the open-source world. But if you dont/cannot, then you have no right to criticize or even comment on this thread (so says i).
No be fight matter. It was constructive criticism. I am sure you dont like that. Anyway we are no way in the same league. I dont need to post any github url cos we no dey the same level na. I intended it as constructive anyway. And for your info, i dont do php stuff. I do stuff you day dream about (highly scalable applications). I got here by allowing people criticize me. Although he dey pain but it made me become who i am.

1 Like

Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 12:58pm On Feb 16, 2016
dhtml18:
The thing is that I truly doubt if some people on this thread have enough brains to understand what this stuff is really about, contrary to their big talks.
A person can look at a code and not really understand what it does, or how it does what it does - their is that in programming. It takes a programmer with real brains to truly understand my codes even with all the documentations.
So seunthomas, i truly understand your pains, but unfortunately, I cannot help you. So my strong advice to you is that you do not use this library - use the better ones you know of or better still, build your own.

Saying a wrapper is trying to re-invent the wheel means that you truly do not understand what you say. jQuery is trying to re-invent the wheel too because it is still javaScript in your own words right?

#My respect for you has dropped by 99% by this your very interesting statement. I know you are trying to simply act annoying/jealous as usual, but you have done it in a way that actually makes you look like a learner (i still believe you have more brains than this, but i might be wrong).

Before you start any e-fight, please post the link to your github make we inspect am to see your contributions to the open-source world. But if you dont/cannot, then you have no right to criticize or even comment on this thread (so says i).
The 1% respect is still very adequate, with me the odds are always in my favour. grin Just read between the lines of your jquery statement. Please note jQuery is not even a wrapper around javascript. Its actually an extension of the general javascript dialect or best still a framework for javascript.

1 Like

Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 1:45pm On Feb 16, 2016
seunthomas:

No be fight matter. It was constructive criticism. I am sure you dont like that. Anyway we are no way in the same league. I dont need to post any github url cos we no dey the same level na. I intended it as constructive anyway. And for your info, i dont do php stuff. I do stuff you day dream about (highly scalable applications). I got here by allowing people criticize me. Although he dey pain but it made me become who i am.

The moment you started with your first comment, i could see right away that you do not understand the code or the purpose at all. It takes a PHP/MySQLi user to actually understand the power/potentiality of this great library.

So by your own admission, you don't even understand PHP code and yet you come here with all this your big-boi stuffs? Shaking my head for you (It is because of people like you that our programming sector in naija is actually backward).

Since i am not arguing with a fellow PHP coder, I honourably rest my case.


FYI: PHP is just one out of the several languages that a use (over a dozen). Please seunt, an advise for you - dont start a fight that your chances of winning are less than 50%.

I hope you do realize that you have been soundly defeated.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 1:51pm On Feb 16, 2016
dhtml18:


So by your own admission, you don't even understand PHP code and yet you come here with all this your big-boi stuffs? Shaking my head for you (It is because of people like you that our programming sector in naija is actually backward).

You have nothing, zip, zero of importance in your github, so stop making mouth anyhow. Real programmers have github account these days with a few useful things for the community to consume. You have no excuse for that.

Even now, international companies use it as part of their assessment of a programmer, alongside with your blog or whatever it is that you publish online. If you do not know these things that I am saying, then you are a learner and a NOOB (at the same time).
I am a GURU in php,java,objective c,swift,c#,c++/c,python,ruby,perl,erlang cant remember the rest. Point of correction, its because of people like you that our programming sector is backward. You feel you know ohhh. I wish you really knew me ohhh. You go fear. But if you are ready to humble yourself and stop this fighting maybe we can exchange contact.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:00pm On Feb 16, 2016
seunthomas:

I am a GURU in php,java,objective c,swift,c#,c++/c,python,ruby,perl,erlang cant remember the rest. Point of correction, its because of people like you that our programming sector is backward. You feel you know ohhh. I wish you really knew me ohhh. You go fear. But if you are ready to humble yourself and stop this fighting maybe we can exchange contact.
You are really confused, one moment you dont use PHP, in another statement, you are a GURU in PHP. I dont know which one to believe again, it appears that you are a LIAR or a DISCOMBOLATED HUMAN BEING.

1 Like

Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:02pm On Feb 16, 2016
As at the last time i checked, i code in more than 15 languages, but that is irrelevant. I have projects and stuffs to show in each of those languages, and i dont just make mouth for nothing (unlike you).
I don't understand the kind of GURU that does not have a github account - or are you ashamed to show us your public repository?
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 2:04pm On Feb 16, 2016
dhtml18:

You are really confused, one moment you dont use PHP, in another statement, you are a GURU in PHP. I dont know which one to believe again, it appears that you are a LIAR or a DISCOMBOLATED HUMAN BEING.
You just know how to use big grammar. I like the way you use singleton pattern in your library but you seem to confuse it. Go and check 415 and 417 breaking a very big rule of oop. Anyway am not after your shine. Rather than insult me, you can either go and fix you very poor code or scrap it for something more efficient.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:14pm On Feb 16, 2016
BTW: I am rather surprised you actually understand what a "singleton pattern" is, so i hereby increase my opinion of you to 69% (you are close to 70%).

@seunthomas: a true warrior knows when he has been defeated (accept defeat in good faith, i don't have to clean the floor with you all over again now).
Other than that, i actually have codes to write, and money to make. This library+argument will not fetch me NGN 1.00.
At this juncture, I take the 4th amendment and hereby honorably rest my case (since my point has been made).


To be continued. . . . .watch out for part 2
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 2:27pm On Feb 16, 2016
dhtml18:
BTW: I am rather surprised you actually understand what a "singleton pattern" is, so i hereby increase my opinion of you to 69% (you are close to 70%).

@seunthomas: a true warrior knows when he has been defeated (accept defeat in good faith, i don't have to clean the floor with you all over again now).
Other than that, i actually have codes to write, and money to make. This library+argument will not fetch me NGN 1.00.
At this juncture, I take the 4th amendment and hereby honorably rest my case (since my point has been made).


To be continued. . . . .watch out for part 2
Dreamer like you. You cant defeat me na. I dey use play. He get one code wey dey trouble. Am kinda using this to clear the very hot steamy engine. I still insists that your "wrapper" is a death trap and would probably lead to lots of memory leaks. The connections you are trying to reuse is actually not happening. Everytime your page is called, when your condition fails, the connection will still be recreated. Mind you regular php has a very bad memory management compared to languages like Java and .Net with garbage collection. I can bet you using your wrapper and using normal php mysqli, i stand a change of having more database connections than with regular mysqli. From the way i see the code, you probably copied some of it. Lacks consistency or maybe you are just a very disconnected programmer??
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by GodMode: 2:38pm On Feb 16, 2016
its dhtml18 vs seunthomas... grin grin grin


GRABS POPCORN.... shocked shocked shocked shocked
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:39pm On Feb 16, 2016
We are back from our short break. All i see there are words - words dont scare me. Codes do, now i dare/challenge/double-dare you to write a code to show that my wrapper is a death trap or that it has memory leaks and I shall listen to you - that is what real programmers do on stack overflow.

One dude was even trying to prove that a function he wrote was actually faster than an inbuilt php function, and he proved it. In that place, programmers are more actions and less words. With all your talks on this thread, I am yet to see a simple line of code or counter-code - not even a github link? I dont even have substantial evidence to believe that you are even a programmer to be quite honest.

But until you have a counter-code, all i can say is - empty barrels make the loudest noise.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:43pm On Feb 16, 2016
seunthomas:

Dreamer like you. You cant defeat me na. I dey use play. He get one code wey dey trouble. Am kinda using this to clear the very hot steamy engine. I still insists that your "wrapper" is a death trap and would probably lead to lots of memory leaks. The connections you are trying to reuse is actually not happening. Everytime your page is called, when your condition fails, the connection will still be recreated. Mind you regular php has a very bad memory management compared to languages like Java and .Net with garbage collection. I can bet you using your wrapper and using normal php mysqli, i stand a change of having more database connections than with regular mysqli. From the way i see the code, you probably copied some of it. Lacks consistency or maybe you are just a very disconnected programmer??


Na were you get that quote from? Let me correct something, my library supports persistent connection - you know what that means eh?
You are not talking like a PHP programmer at all.

Now, the dude is accusing me of copy-and-paste code eh? You are wrong, I COPIED ALL THE GADDAMN CODES, OYA SAY ANOTHER ONE.
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by Nobody: 2:46pm On Feb 16, 2016
seunthomas:

Dreamer like you. You cant defeat me na. I dey use play. He get one code wey dey trouble. Am kinda using this to clear the very hot steamy engine. I still insists that your "wrapper" is a death trap and would probably lead to lots of memory leaks. The connections you are trying to reuse is actually not happening. Everytime your page is called, when your condition fails, the connection will still be recreated. Mind you regular php has a very bad memory management compared to languages like Java and .Net with garbage collection. I can bet you using your wrapper and using normal php mysqli, i stand a change of having more database connections than with regular mysqli. From the way i see the code, you probably copied some of it. Lacks consistency or maybe you are just a very disconnected programmer??


Sorry, my brain cannot really debug what you are trying to say there. It appears you are saying my code uses normal mysqli?
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 2:47pm On Feb 16, 2016
GodMode:
its dhtml18 vs seunthomas... grin grin grin


GRABS POPCORN.... shocked shocked shocked shocked
@GodMode you do me a great injustice. He is the challenger not the other way around. Na him challenge me say make i prove say i be guru. By the way i like your name. Reminds me of something that boy called bill put inside his OS. Abi na you put am?
Re: DHTMLSQL - A Very Advanced Wrapper For Mysql Database! by seunthomas: 2:49pm On Feb 16, 2016
dhtml18:

Sorry, my brain cannot really debug what you are trying to say there. It appears you are saying my code uses normal mysqli?
Your brain cant debug na. When you are running pentium 1 in the days of core i7. Small boy.lol. grin

(1) (2) (3) (4) (Reply)

Tracking Position Via The Internet / Free Coding Ask And Answer (CAA) Group / Why Do HTML5 Mobile Apps Have A Bad Reputation (cordova / Phonegap)?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 83
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.