A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 102

Backtrace:

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 128

Backtrace:

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$hooks is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$config is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$log is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$uri is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$router is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$output is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$security is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$input is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$lang is deprecated

Filename: core/Controller.php

Line Number: 83

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$db is deprecated

Filename: core/Loader.php

Line Number: 397

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_DB_mysqli_driver::$failover is deprecated

Filename: database/DB_driver.php

Line Number: 372

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 10
Function: __construct

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$session is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 11
Function: library

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 6
Function: __construct

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$dcphpmailer is deprecated

Filename: core/Loader.php

Line Number: 1284

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 11
Function: library

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$model is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 13
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$categories is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 15
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$postcat is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 19
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$comment is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 23
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$user is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 27
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$coderunner is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 32
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$toc is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 37
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$data is deprecated

Filename: controllers/Blog.php

Line Number: 39

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 39
Function: _error_handler

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property blog::$meta is deprecated

Filename: core/Loader.php

Line Number: 359

Backtrace:

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 42
Function: model

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$state is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$userrole is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$user_id is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$db is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$session is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$dcphpmailer is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$model is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$categories is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$postcat is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$comment is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$user is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$coderunner is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$toc is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$data is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$meta is deprecated

Filename: core/Loader.php

Line Number: 932

Backtrace:

File: /home/u1494823/public_html/deretcode/application/core/DC_Controller.php
Line: 33
Function: view

File: /home/u1494823/public_html/deretcode/application/controllers/Blog.php
Line: 77
Function: view

File: /home/u1494823/public_html/deretcode/start.php
Line: 315
Function: require_once

Membuat Fungsi Query Builder Sederhana Dengan Bahasa Pemrogramman C#
Mode Malam
| Mode Tampilan
Penulis : admin

Home » Programming » Membuat Fungsi Query Builder Sederhana Dengan Bahasa Pemrogramman C#
Membuat Fungsi Query Builder Sederhana Dengan Bahasa Pemrogramman C#

Membuat Fungsi Query Builder Sederhana Dengan Bahasa Pemrogramman C#


Query builder adalah sebuah fungsi yang dapat membantu kita dalam membuat query sql untuk meminimalisir kesalahan pengetikan (typo) ketika membuat query tersebut. Seperti yang kita ketahui, code editor tidak akan bisa mengkoreksi keselahan pada query yang kita buat sebelum program tersebut di jalankan. Sehingga dalam menulis query terkadang mengalami kesalahan.

Ketika kita menggunkan sebuah framework dalam membangun sebuah program, biasanya framework tersebut sudah menyediakan query builder didalamnya. Contohnya framework php laravel, cara menggunakan query buildernya  seperti berikut.

advertisement

$tabels = DB::table('nama_table')->get();

Kita cukup memasukan nama tablenya saja untuk membuat query "select * from nama_table".

Pada kesempatan kali ini, kita akan belajar bagaimana cara membuat fungsi query builder dengan menggunakan bahasa pemrogramman csharp.

Membuat Class Query Builder Di C#

Oke langsung saja, biat sebuah class bernama QueryBuilder dan silahkan kalian ketik code dibawah ini, nanti kita akan jelaskan satu persatu.

namespace QueryBuilder_csharp
{
    class QueryBuilder
    {
        private String connection = "";
        public QueryBuilder(String connection)
        {
            this.connection = connection;
        }
        public querySelect Select()
        {
            return new querySelect(connection);
        }
        public queryInsert Insert()
        {
            return new queryInsert(connection);
        }
        public queryUpdate Update()
        {
            return new queryUpdate(connection);
        }
        public queryDelete Delete()
        {
            return new queryDelete(connection);
        }
    }
    class querySelect
    {
        String cols = "";
        String tbl = "";
        String where = "";
        String con = "";
        public querySelect(String con)
        {
            this.con = con;
        }
        public querySelect Columns(string columns){
            this.cols = columns;
            return this;
        }
        public querySelect Table(string table)
        {
            this.tbl = table;
            return this;
        }
        public querySelect Where(string where)
        {
            this.where = where;
            return this;
        }
        public DataTable Get()
        {
            var ds = new DataSet();
            var connection = new SqlConnection(con);
            connection.Open();
            new SqlDataAdapter("select " + cols + " from " + tbl + " where " + where, con).Fill(ds);
            connection.Close();
            return ds.Tables[0];
        }
    }
    class queryInsert
    {
        String cols = "";
        String vals = "";
        String tbl = "";
        String where = "";
        String con = "";
        public queryInsert(String con)
        {
            this.con = con;
        }
        public queryInsert Columns(string columns)
        {
            this.cols = columns;
            return this;
        }
        public queryInsert Values(string values)
        {
            this.vals = values;
            return this;
        }
        public queryInsert Table(string table)
        {
            this.tbl = table;
            return this;
        }
        public queryInsert Where(string where)
        {
            this.where = where;
            return this;
        }
        public Boolean Execute()
        {
            try
            {
                var connection = new SqlConnection(con);
                connection.Open();
                var sqlcom = new SqlCommand("insert into " + tbl +" "+ cols +" values (" + vals + ")'", connection);
                sqlcom.ExecuteNonQuery();
                connection.Close();
                return true;
            }
            catch (Exception)
            {

                return false;
            }
        }
    }
    class queryUpdate
    {
        String set = "";
        String tbl = "";
        String where = "";
        String con = "";
        public queryUpdate(String con)
        {
            this.con = con;
        }
        public queryUpdate Set(string set)
        {
            this.set = set;
            return this;
        }
        public queryUpdate Table(string table)
        {
            this.tbl = table;
            return this;
        }
        public queryUpdate Where(string where)
        {
            this.where = where;
            return this;
        }
        public Boolean Execute()
        {
            try
            {
                var connection = new SqlConnection(con);
                connection.Open();
                var sqlcom = new SqlCommand("update "+ tbl +" set "+set+" where "+where, connection);
                sqlcom.ExecuteNonQuery();
                connection.Close();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
    class queryDelete
    {
        String tbl = "";
        String where = "";
        String con = "";
        public queryDelete(String con)
        {
            this.con = con;
        }
        public queryDelete Table(string table)
        {
            this.tbl = table;
            return this;
        }
        public queryDelete Where(string where)
        {
            this.where = where;
            return this;
        }
        public Boolean Execute()
        {
            try
            {
                var connection = new SqlConnection(con);
                connection.Open();
                var sqlcom = new SqlCommand("delete from " + tbl + " where " + where, connection);
                sqlcom.ExecuteNonQuery();
                connection.Close();
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
    }
}

Penjelasan:

Didalam class QueryBuilder ada empat class lain querySelect, queryInsert, queryUpdate dan queryDelete. 

advertisement

1. Class QueryBuilder adalah class utama yang nantinya akan digunakan untuk membuat object query buildernya. Didalam class QueryBuilder  ada method contruct yang berfungsi untuk melakukan menset Koneksi databasenya.

'''
public QueryBuilder(String connection)
{
     this.connection = connection;
}
...

Selain itu didalamnya juga ada empat method yang berfungsi untuk memebuat dan ,mengembalika object dari class querySelect, queryInsert, queryUpdate dan queryDelete. 

...
public querySelect Select()
{
	return new querySelect(connection);
}
public queryInsert Insert()
{
	return new queryInsert(connection);
}
public queryUpdate Update()
{
	return new queryUpdate(connection);
}
public queryDelete Delete()
{
	return new queryDelete(connection);
}
...

2. Class querySelect adalah sebuah class yang memiliki fungsi untuk mengenerate query select. Hal menarik dari class ini adalah methode yang mereturn classnya sendiri dan menset variable yang ada di class tersebut, yaitu methode Columns, Table dan Where. Ada juga methode Get yang membangun query dan mengembalikannya dalam bentuk DataTable.

...
public querySelect Columns(string columns){
	this.cols = columns;
	return this;
}
public querySelect Table(string table)
{
	this.tbl = table;
	return this;
}
public querySelect Where(string where)
{
	this.where = where;
	return this;
}
public DataTable Get()
{
	var ds = new DataSet();
	var connection = new SqlConnection(con);
	connection.Open();
	new SqlDataAdapter("select " + cols + " from " + tbl + " where " + where, con).Fill(ds);
	connection.Close();
	return ds.Tables[0];
}
...

3. Class queryInsert adalah sebuah class yang digunakan untuk mengenerate query insert. Sama seperti class querySelect, di class ini juga memiliki methode yang mengembalikan classnya sendiri. Ada juga class Execetue yang berfungsi untuk membangun query insert dan mengeksekusinya query tersebut. Mehte Execute mengembalikan data True jika berhasil mengeksekusi query dan False jika gagal.

...
public Boolean Execute()
{
	try
	{
		var connection = new SqlConnection(con);
		connection.Open();
		var sqlcom = new SqlCommand("insert into " + tbl +" "+ cols +" values (" + vals + ")'", connection);
		sqlcom.ExecuteNonQuery();
		connection.Close();
		return true;
	}
	catch (Exception)
	{
		return false;
	}
}
...

4. Class queryUpdate hampir sama seperti class sebelumnya, yang membedakannya hanya pada methode Execute yang memiliki fungsi untuk membangun query update.

...
public Boolean Execute()
{
	try
	{
		var connection = new SqlConnection(con);
		connection.Open();
		var sqlcom = new SqlCommand("update "+ tbl +" set "+set+" where "+where, connection);
		sqlcom.ExecuteNonQuery();
		connection.Close();
		return true;
	}
	catch (Exception)
	{
		return false;
	}
}
...

5. Class queryDelete  memiliki struktur yang hampir sama dengan class sebelumnya, hanya saja pada methode Execute yang memilki fungsi untuk membangun query delete.

...
public Boolean Execute()
{
	try
	{
		var connection = new SqlConnection(con);
		connection.Open();
		var sqlcom = new SqlCommand("delete from " + tbl + " where " + where, connection);
		sqlcom.ExecuteNonQuery();
		connection.Close();
		return true;
	}
	catch (Exception)
	{
		return false;
	}
}
...

Cara Menggunakan Class Query Builder

Sekarang kita masuk ke tahap bagaimana cara menggunakan class QueryBuildernya. Silahkan lihat code berikut ini.

//Membuat object QueryBuilder dan menset koneksi databasenya
var qb = new QueryBuilder("Ganti dengan koneksi string kalian");

//Cara menselect data menggunakan query builder
var dataTable = qb.Select().Columns("col1,col2").Table("table").Where("col1=2").Get();

//Cara menginsert data menggunakan query builder
var successInsert = qb.Insert().Columns("col1,col2").Values("'1','deretcode'").Table("table").Where("col1=2").Execute();

//Cara mengupdate data menggunakan query builder
var successUpdate = qb.Update().Set("col2='deretcode'").Table("table").Where("col1=1").Execute();

//Cara mendelete data menggunakan query builder
var succesDelete = qb.Delete().Table("table").Where("col1=2").Execute();

Gimana mudah bukan cara implementasinya?

Fungsi QueryBuilder yang barusan kita bikin memiliki fungsi yang sangat terbatas oleh karena itu silahkan kalian kembangkan sendiri fungsi-fungsinya seperti menambahkan methode Join, methode sub query dan lain sebagainya. Kalian juga bisa membuatnya di bahasa pemrogramman yang lain, yang mendukung OOP (Object Oriented Programming) tentunya.

advertisement

Sampai disini dulu tutorial membuat fungsi query buildernya. Jangan lupa di share jika kalian merasa artikel ini bermanfaat, kalau ada pertanyaan silahkan tulis di kolom komentar. Good luck!

 

 

Tags: #querybuilder #sql #csharp
Bagikan :

Komentar:

Silahkan berkomentar dengan baik dan bijak!

Name * :
Email :
Website :
Comment :


This website uses cookies to ensure you get the best experience on our website

learn more