Welcome Guest, Not a member yet? Register   Sign In
Extends Database Library
#1

(This post was last modified: 03-17-2020, 03:32 PM by emaidana.)

Hello,

I'm trying to extend the database library in order to "prepare" all the queries (raw and generated by builder); in this method I'll take care of virtual views names replacement. 

For example this query:

Code:
SELECT 1 FROM @vw_users@ LIMIT 10;

Will turn into this:

Code:
SELECT
    1
FROM
    (
        SELECT
            id, name, address
        FROM
            users
        WHERE
            status='active'
    ) AS vw_users
LIMIT 10;

Based on this definition:

PHP Code:
$views["vw_users"] = 
"
    SELECT
        id, name, address
    FROM
        users
    WHERE
        status='active'
"


I already read the answer posted by kilishan at https://forum.codeigniter.com/thread-741...#pid366477 but I can't resign myself to that.

How can I achieved this like I did it in CI3 extending core classes?

Regards.
Reply


Messages In This Thread
Extends Database Library - by emaidana - 03-17-2020, 11:51 AM
RE: Extends Database Library - by MGatner - 03-23-2020, 09:12 AM
RE: Extends Database Library - by emaidana - 04-16-2020, 10:05 AM
RE: Extends Database Library - by sstefanov - 05-08-2023, 05:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB