[Gambas-user] Forbid DataSource to fetch certain fields
Benoît Minisini
gambas at ...1...
Sun Sep 30 18:41:05 CEST 2012
Le 30/09/2012 11:48, Tobias Boege a écrit :
>>>> DataSource can take a SQL request instead of a table. But then you
>>>> cannot modify the records.
>>>>
>>>> --
>>>> Beno?t Minisini
>>>
>>> Bruce, clever idea. That's certainly feasible but a workaround.
>>> Benoit, is there any reason there is no such DataSource.Columns As String[]?
>>>
>>> Regards,
>>> Tobi
>>>
>>
>> Because using your own SQL request is more powerful.
>>
>> --
>> Beno?t Minisini
>>
>
> Could you please elaborate on that? I don't understand how to do it. Do you
> mean I could use:
>
> DataSource.Table = "SELECT id,title FROM my_table" ' instead of "my_table"
Yes.
>
> If you say that one couldn't modify records when using their own SQL it may
> be more powerful in that one case but limiting in the other... Do I get that
> right?
>
> Regards,
> Tobi
>
To modify a record, I need its primary key. But when doing a SELECT, I
cannot know for sure how to get it.
But maybe I can detect that the SELECT request is on just one table, and
add the primary key to it.
Or add a way to specify which fields we want from the table. But I have
to add a property for that everywhere we find a Table property ; or find
another way...
--
Benoît Minisini
More information about the User
mailing list