Welcome Guest, Not a member yet? Register   Sign In
sql sorgu farklılıkları
#1

(This post was last modified: 05-17-2024, 09:23 AM by mywebmanavgat.)

When I examine the logs on mssql, some queries
Some queries come in dynamic variable structure while some queries are forwarded in plain tsql.

Plain structure:
SELECT * FROM test_table where id='1' and status='OPEN'

Variable structure :
(@1 tinyint,@2 varchar(8000))SELECT * FROM [test_table] WHERE [id]=@1 AND [status]=@2

How do I ensure that queries are always sent in a variable structure when using activated record?

How does codeigniter manage this variable?



If I send where to the id column, which is the primary and identy column in the table, it produces a parameterized result. But if I send where to the service column
logging a straight sql query.;




PHP Code:
$this->db->select('*');
$this->db->where('service','55');
$this->db->order_by('id','asc');
$this->db->get('test_table')->row();

echo 
$this->db->last_query();

echo 
"-----<br>-----";

$this->db->select('*');
$this->db->where('service','55');
$this->db->order_by('id','asc');
$this->db->get('test_table')->row();

echo 
$this->db->last_query();


//Active Record Get Last Query:
SELECT FROM "test_table" WHERE "id" '55' ORDER BY "id" ASC
----------
SELECT FROM "test_table" WHERE "service" '55' ORDER BY "id" ASC 

//Mssql Query History Log
(@1 varchar(8000))SELECT FROM [test_tableWHERE [id]=@1 ORDER BY [idASC
SELECT 
FROM "test_table" WHERE "servis" '55' ORDER BY "id" ASC 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB