@@ -743,6 +743,82 @@ public function build_operator_space_ship_to($id, $field = 'id', $table = '')
743743 return $ this ->db ;
744744 }
745745
746+ // ------------------------------------------ Database Metadata ------------------------------------------ //
747+
748+ /**
749+ * Function list_tables
750+ *
751+ * @return array|false|string
752+ * @author : 713uk13m <dev@nguyenanhung.com>
753+ * @copyright: 713uk13m <dev@nguyenanhung.com>
754+ * @time : 16/02/2023 21:09
755+ */
756+ public function list_tables ()
757+ {
758+ return $ this ->db ->list_tables ();
759+ }
760+
761+ /**
762+ * Function table_exists
763+ *
764+ * @param $table
765+ *
766+ * @return bool
767+ * @author : 713uk13m <dev@nguyenanhung.com>
768+ * @copyright: 713uk13m <dev@nguyenanhung.com>
769+ * @time : 16/02/2023 25:08
770+ */
771+ public function table_exists ($ table )
772+ {
773+ return $ this ->db ->table_exists ($ table );
774+ }
775+
776+ /**
777+ * Function list_fields_on_table
778+ *
779+ * @param $table
780+ *
781+ * @return array|false|string
782+ * @author : 713uk13m <dev@nguyenanhung.com>
783+ * @copyright: 713uk13m <dev@nguyenanhung.com>
784+ * @time : 16/02/2023 25:23
785+ */
786+ public function list_fields_on_table ($ table )
787+ {
788+ return $ this ->db ->list_fields ($ table );
789+ }
790+
791+ /**
792+ * Function field_exists_on_table
793+ *
794+ * @param $field
795+ * @param $table
796+ *
797+ * @return bool
798+ * @author : 713uk13m <dev@nguyenanhung.com>
799+ * @copyright: 713uk13m <dev@nguyenanhung.com>
800+ * @time : 16/02/2023 26:47
801+ */
802+ public function field_exists_on_table ($ field , $ table )
803+ {
804+ return $ this ->db ->field_exists ($ field , $ table );
805+ }
806+
807+ /**
808+ * Function list_all_field_data
809+ *
810+ * @param $table
811+ *
812+ * @return array|false
813+ * @author : 713uk13m <dev@nguyenanhung.com>
814+ * @copyright: 713uk13m <dev@nguyenanhung.com>
815+ * @time : 16/02/2023 26:44
816+ */
817+ public function list_all_field_data ($ table )
818+ {
819+ return $ this ->db ->field_data ($ table );
820+ }
821+
746822 // ---------------------------------------------------------------------------------------------------------------------------------------- //
747823
748824 /**
@@ -758,7 +834,7 @@ public function build_operator_space_ship_to($id, $field = 'id', $table = '')
758834 */
759835 public function check_exists ($ value = '' , $ field = null )
760836 {
761- $ this ->db ->select (' id ' );
837+ $ this ->db ->select ($ this -> primary_key );
762838 $ this ->db ->from ($ this ->tableName );
763839 if ($ field === null ) {
764840 $ this ->db ->where ($ this ->primary_key , $ value );
@@ -862,12 +938,12 @@ public function get_all($field = '*')
862938 /**
863939 * Function get_all_asc
864940 *
865- * @param string $field
941+ * @param $field
866942 *
867943 * @return array|array[]|object|object[]
868944 * @author : 713uk13m <dev@nguyenanhung.com>
869945 * @copyright: 713uk13m <dev@nguyenanhung.com>
870- * @time : 08/ 16/2021 30:03
946+ * @time : 16/02/2023 19:08
871947 */
872948 public function get_all_asc ($ field = '* ' )
873949 {
@@ -878,6 +954,25 @@ public function get_all_asc($field = '*')
878954 return $ this ->db ->get ()->result ();
879955 }
880956
957+ /**
958+ * Function get_all_desc
959+ *
960+ * @param $field
961+ *
962+ * @return array|array[]|object|object[]
963+ * @author : 713uk13m <dev@nguyenanhung.com>
964+ * @copyright: 713uk13m <dev@nguyenanhung.com>
965+ * @time : 16/02/2023 19:03
966+ */
967+ public function get_all_desc ($ field = '* ' )
968+ {
969+ $ this ->db ->select ($ field );
970+ $ this ->db ->from ($ this ->tableName );
971+ $ this ->db ->order_by ($ field , 'DESC ' );
972+
973+ return $ this ->db ->get ()->result ();
974+ }
975+
881976 /**
882977 * Function count_all
883978 *
0 commit comments