<commit_before><?php
/**
 * @ignore
 */
//require our include.php file which does our database initialization
require_once("include/include.php");

//require our DisplayHelper class for printing page content
require_once("include/DisplayHelper.php");

DisplayHelper::PrintTemplateTop("list-all-rows.php");
DisplayHelper::PrintTitle("list-all-rows.php");

//shortcut to the Customer table so we don't have to keep writing it.
//typically wouldn't do this, but it can make things cleaner sometimes
$cTable = $GLOBALS['db']['Customer'];

//for example, these now are exactly the same:
//$cTable['CustomerId']->...
//$GLOBALS['db']['Customer']['CustomerId']->...
?>
<table cellspacing="1">
	<tbody>
		<tr>
			<th><?=$cTable['CustomerId']->DisplayName?></th>
			<th><?=$cTable['Name']->DisplayName?></th>
			<th><?=$cTable['EmailAddress']->DisplayName?></th>
			<th><?=$cTable['Gender']->DisplayName?></th>
			<th><?=$cTable['DateCreated']->DisplayName?></th>
			<th><?=$cTable['DateLastModified']->DisplayName?></th>
		</tr>
		<?
		//get all rows in the Customer table
		$allRows = $cTable->GetAllRows(array(
			'order-by'=>"CustomerId", //optional options. see documentation api
			'return-count'=>&$numRows //OUT parameter. number of rows returned
		));
		
		if($numRows == 0){
			?>
			<tr>
				<td colspan="6"><strong>NO ROWS</strong></td>
			</tr>
			<?
		}
		
		//loop over all data and print it (if any)
		foreach($allRows as $Customer){
			?>
			<tr>
				<td><?=$Customer['CustomerId']()?></td>
				<td><?=$Customer['Name'](true,true)?></td>
				<td><?=$Customer['EmailAddress'](true,true)?></td>
				<td><?=$Customer['Gender']()?></td>
				<td><?=$Customer["DateCreated"]() ? date("M d, Y - g:i:s a",$Customer["DateCreated"](true)) : ""?></td>
				<td><?=$Customer["DateLastModified"]()  ? date("M d, Y - g:i:s a",$Customer["DateLastModified"](true)) : ""?></td>
			</tr>
			<?
		}
		?>
	</tbody>
</table>
<?

DisplayHelper::PrintCode('
//outline (see source for full code)
require_once("include/include.php");

//shortcut to the Customer table so we don`t have to keep writing it.
//typically wouldn`t do this, but it can make things cleaner sometimes
$cTable = $GLOBALS["db"]["Customer"];

//for example, these now are exactly the same:
//$cTable["CustomerId"]->...
//$GLOBALS["db"]["Customer"]["CustomerId"]->...
?>
<table cellspacing="1">
	<tbody>
		<tr>
			<th><?=$cTable["CustomerId"]->DisplayName?></th>
			<th><?=$cTable["Name"]->DisplayName?></th>
			<th><?=$cTable["EmailAddress"]->DisplayName?></th>
			<th><?=$cTable["Gender"]->DisplayName?></th>
			<th><?=$cTable["DateCreated"]->DisplayName?></th>
			<th><?=$cTable["DateLastModified"]->DisplayName?></th>
		</tr>
		<?
		//get all rows in the Customer table
		$allRows = $cTable->GetAllRows(array(
			"order-by"=>"CustomerId", //optional options. see documentation api
			"return-count"=>&$numRows //OUT parameter. number of rows returned
		));
		
		if($numRows == 0){
			?>
			<tr>
				<td colspan="6"><strong>NO ROWS</strong></td>
			</tr>
			<?
		}
		
		//loop over all data and print it (if any)
		foreach($allRows as $Customer){
			?>
			<tr>
				<td><?=$Customer["CustomerId"]()?></td>
				<td><?=$Customer["Name"](true,true)?></td>
				<td><?=$Customer["EmailAddress"](true,true)?></td>
				<td><?=$Customer["Gender"]()?></td>
				<td><?=
					$Customer["DateCreated"]()
					 ? date("M d, Y - g:i:s a",$Customer["DateCreated"](true))
					 : ""
				?></td>
				<td><?=
					$Customer["DateLastModified"]()
					 ? date("M d, Y - g:i:s a",$Customer["DateLastModified"](true))
					 : ""
				?></td>
			</tr>
			<?
		}
		?>
	</tbody>
</table>
<?

', 'java');
DisplayHelper::PrintSourceLink("https://github.com/cirkuitnet/PHP-SmartDB/blob/master/samples/basic/list-all-rows.php");
DisplayHelper::PrintTemplateBottom();
?><commit_msg>Small update to clean up the 'list-all-rows' sample<commit_after><?php
/**
 * @ignore
 */
//require our include.php file which does our database initialization
require_once("include/include.php");

//require our DisplayHelper class for printing page content
require_once("include/DisplayHelper.php");

DisplayHelper::PrintTemplateTop("list-all-rows.php");
DisplayHelper::PrintTitle("list-all-rows.php");

//shortcut to the Customer table so we don't have to keep writing it.
//typically wouldn't do this, but it can make things cleaner sometimes
$cTable = $GLOBALS['db']['Customer'];

//for example, these now are exactly the same:
//$cTable['CustomerId']->...
//$GLOBALS['db']['Customer']['CustomerId']->...

//get all rows in the Customer table
$allRows = $cTable->GetAllRows(array(
	'order-by'=>"CustomerId", //optional options. see documentation api
	'return-count'=>&$numRows //optional OUT parameter. $numRows will be set to the number of rows returned
	//other options available here... see documentation api
));
?>
<table cellspacing="1">
	<tbody>
		<tr>
			<th><?=$cTable['CustomerId']->DisplayName?></th>
			<th><?=$cTable['Name']->DisplayName?></th>
			<th><?=$cTable['EmailAddress']->DisplayName?></th>
			<th><?=$cTable['Gender']->DisplayName?></th>
			<th><?=$cTable['DateCreated']->DisplayName?></th>
			<th><?=$cTable['DateLastModified']->DisplayName?></th>
		</tr>
		<?
		if($numRows == 0){ 
			?> <tr>
				<td colspan="6"><strong>NO ROWS</strong></td>
			</tr> <?
		}
		else{ //loop over all rows and print the info
			foreach($allRows as $Customer){
				?>
				<tr>
					<td><?=$Customer['CustomerId']()?></td>
					<td><?=$Customer['Name'](true,true)?></td>
					<td><?=$Customer['EmailAddress'](true,true)?></td>
					<td><?=$Customer['Gender']()?></td>
					<td><?=$Customer["DateCreated"]() ? date("M d, Y - g:i:s a",$Customer["DateCreated"](true)) : ""?></td>
					<td><?=$Customer["DateLastModified"]()  ? date("M d, Y - g:i:s a",$Customer["DateLastModified"](true)) : ""?></td>
				</tr>
				<?
			}
		}
		?>
	</tbody>
</table>
<?

DisplayHelper::PrintCode('
//outline (see source for full code)
require_once("include/include.php");

//shortcut to the Customer table so we don`t have to keep writing it.
//typically wouldn`t do this, but it can make things cleaner sometimes
$cTable = $GLOBALS["db"]["Customer"];

//for example, these now are exactly the same:
//$cTable["CustomerId"]->...
//$GLOBALS["db"]["Customer"]["CustomerId"]->...

//get all rows in the Customer table
$allRows = $cTable->GetAllRows(array(
	"order-by"=>"CustomerId", //optional options. see documentation api
	"return-count"=>&$numRows //optional OUT parameter. $numRows will be SET
	//other options available here... see documentation api
));
?>
<table cellspacing="1">
	<tbody>
		<tr>
			<th><?=$cTable["CustomerId"]->DisplayName?></th>
			<th><?=$cTable["Name"]->DisplayName?></th>
			<th><?=$cTable["EmailAddress"]->DisplayName?></th>
			<th><?=$cTable["Gender"]->DisplayName?></th>
			<th><?=$cTable["DateCreated"]->DisplayName?></th>
			<th><?=$cTable["DateLastModified"]->DisplayName?></th>
		</tr>
		<?
		if($numRows == 0){ 
			?> <tr>
				<td colspan="6"><strong>NO ROWS</strong></td>
			</tr> <?
		}
		else{ //loop over all rows and print the info
			foreach($allRows as $Customer){
				?>
				<tr>
					<td><?=$Customer["CustomerId"]()?></td>
					<td><?=$Customer["Name"](true,true)?></td>
					<td><?=$Customer["EmailAddress"](true,true)?></td>
					<td><?=$Customer["Gender"]()?></td>
					<td><?=$Customer["DateCreated"]()
						? date("M d, Y - g:i:s a",
								$Customer["DateCreated"](true)) : ""?></td>
					<td><?=$Customer["DateLastModified"]()
						? date("M d, Y - g:i:s a"
								$Customer["DateLastModified"](true)) : ""?></td>
				</tr>
				<?
			}
		}
		?>
	</tbody>
</table>
<?

', 'java');
DisplayHelper::PrintSourceLink("https://github.com/cirkuitnet/PHP-SmartDB/blob/master/samples/basic/list-all-rows.php");
DisplayHelper::PrintTemplateBottom();
?>
{'fraction_non_alphanumeric': 0.23786906290115534, 'fraction_numerical': 0.0015404364569961489, 'mean_word_length': 4.314461118690314, 'pattern_counts': {'":': 0, '<': 221, '<?xml version=': 0, '>': 265, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4111173', 'n_tokens_mistral': 3008, 'n_tokens_neox': 2709, 'n_words': 541}