Topics
- bash (4)
- css (3)
- data arch. (14)
- html (6)
- javascript (8)
- mysql (17)
- oracle (10)
- php (7)
- python (13)
- shell tips (17)
- software arch. (10)
- ssh (3)
-
Recent Posts
- scripting Photoshop for stop motion
- locking and concurrency in python, part 2
- locking and concurrency in python, part 1
- zip archive in python
- chaining ssh tunnels
- timeout command in python
- python slice and sql every Nth row
- sqlplus, utility scripts
- screen and screenrc
- nvl, ifnull, nullif, isnull, coalesce
Archives
Category Archives: php
php DB adapter, decorator
Previously, I created a php database adapter that calls mysql stored procedures as if they were local php functions. Now I want to refactor each of the features of the DB adapter into a decorator design pattern. The core database … Continue reading
Posted in php, software arch.
Leave a comment
php DB adapter, revisited
I would like to call mysql stored procedures as if they were local php functions. For example, let's use the following mysql stored procedure, DELIMITER // CREATE PROCEDURE `usersByPage`(page_num INT, per_page INT) BEGIN SET @lim_start = (page_num - 1) * … Continue reading
Posted in mysql, php, software arch.
Leave a comment
php echo and print
Is echo really, even negligibly, faster than print in php? Conventional wisdom of the Internet says "yes", because print performs one extra op (it returns a value). I've seen performance charts with 20% or more difference in performance. I tested … Continue reading
Posted in php
Leave a comment
get_magic_quotes_gpc(), or not
I would like to sanitize user-supplied HTTP request variables before sending them to a database. There is a deprecated PHP setting called magic_quotes_gpc that automatically escapes GET, POST, and COOKIE (GPC) operators. Please understand that magic_quotes_gpc is highly discouraged. <?php … Continue reading
Posted in php
Leave a comment
last_insert_id()
I would like to retrieve the id of a row I just inserted. In Oracle this problem is handled with the use of sequences, SQL> SELECT uid_seq.NEXTVAL INTO user_id FROM DUAL; SQL> INSERT INTO users (id, username) VALUES (user_id, 'joebob'); … Continue reading
Posted in data arch., mysql, php
Leave a comment
php DB adapter, with magic
I would like to encapsulate the handling of database connections, and maintain a loose coupling between database connections and application and data-access code. I'll not focus on connection pooling since that can be handled at the driver level independent of … Continue reading
Posted in mysql, php
Leave a comment
php Namespaces and Class loading
I want to autoload php classes and functions. Ideally, I want a lazy loader (include class files only when they are needed, never including more files than necessary). I'd also like namespace protection (if running PHP 5.3 or later). And … Continue reading
Posted in php
Leave a comment