Block without db.xml

Permalink
Hi;i'm new and im trying to make a block which only reads from a view.i have problem that as i wana install it it doesnt install and it display a message says that the blocktype installed and i dont see any block added.I didnt add any db.xml file to my block becouse i dont need to save data and just wana show.

 
ScottC replied on at Permalink Reply
ScottC
this is bare minimum :)

Look at any block and the bID and copy that field into your db.xml.

These things have to be tracked somewhere and that is where it all starts.

-Scott
khaled replied on at Permalink Reply
hi ScottC;

Acctually i made a view in mysql and wana just retrieve data and show it? so still givingme error.
mysql error: [1347: 'seraj.ticker' is not BASE TABLE] in EXECUTE("ALTER TABLE Ticker MODIFY COLUMN cID INTEGER")
this is the db.xml
<?xml version="1.0"?>

<schema version="0.3">
<table name="Ticker">


<field name="cID" type="I">
</field>

<field name="cPath" type="X2">
</field>

<field name="cvName" type="X2">
</field>

</table>

</schema>
any help plz
87up replied on at Permalink Reply
87up
I am having the same problem. I also only need to retrieve data and disply it without doing any saving. but it won't work without db.xml. And if i only add bID as a field, all the fields from my table (the table i need to retrieve data from) except bID will be deleted.
87up replied on at Permalink Reply
87up
I guess that the only solution to this problem right now, is to make this view block create a new table, that will remain empty and unused at all time.
matogertel replied on at Permalink Reply
matogertel
The minimum for a block db.xml is a table matching the $btTable variable in the block controller. That table needs to have minimumn a bID which needs to be the index, and I discovered that additionally it needs at least one more field (even if you're not using it) so for my blocks that don't need any database access my minimum db.xml looks like this:
<?xml version="1.0"?>
<schema version="0.3">
   <table name="btMyCoolBlock">
      <field name="bID" type="I">
         <key />
         <unsigned />
      </field>
      <field name="dummy" type="I">
      </field>
   </table>
</schema>


Hope that helps!
87up replied on at Permalink Reply
87up
yes, that is my conclusion as well.. thank you for your response.. :)